MCPcopy Index your code
hub / github.com/coder/coder / searchFuzzyFallback

Function searchFuzzyFallback

agent/filefinder/query.go:156–177  ·  view source on GitHub ↗
(plan *queryPlan, snap *Snapshot)

Source from the content-addressed store, hash-verified

154}
155
156func searchFuzzyFallback(plan *queryPlan, snap *Snapshot) []uint32 {
157 if len(plan.BasenameQ) == 0 {
158 return nil
159 }
160 bucket := snap.byPrefix1[prefix1(plan.BasenameQ)]
161 if len(bucket) == 0 {
162 return searchSubsequenceScan(plan, snap, 5000)
163 }
164 var ids []uint32
165 for _, id := range bucket {
166 if snap.deleted[id] || int(id) >= len(snap.docs) {
167 continue
168 }
169 if isSubsequence([]byte(snap.docs[id].path), plan.BasenameQ) {
170 ids = append(ids, id)
171 }
172 }
173 if len(ids) == 0 {
174 return searchSubsequenceScan(plan, snap, 5000)
175 }
176 return ids
177}
178
179func searchSubsequenceScan(plan *queryPlan, snap *Snapshot, maxCheck int) []uint32 {
180 if len(plan.BasenameQ) == 0 {

Callers 1

searchSnapshotFunction · 0.85

Calls 3

prefix1Function · 0.85
searchSubsequenceScanFunction · 0.85
isSubsequenceFunction · 0.85

Tested by

no test coverage detected