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

Function searchSubsequenceScan

agent/filefinder/query.go:179–196  ·  view source on GitHub ↗
(plan *queryPlan, snap *Snapshot, maxCheck int)

Source from the content-addressed store, hash-verified

177}
178
179func searchSubsequenceScan(plan *queryPlan, snap *Snapshot, maxCheck int) []uint32 {
180 if len(plan.BasenameQ) == 0 {
181 return nil
182 }
183 var ids []uint32
184 checked := 0
185 for id := 0; id < len(snap.docs) && checked < maxCheck; id++ {
186 uid := uint32(id) //nolint:gosec // Snapshot count is bounded well below 2^32.
187 if snap.deleted[uid] {
188 continue
189 }
190 checked++
191 if isSubsequence([]byte(snap.docs[id].path), plan.BasenameQ) {
192 ids = append(ids, uid)
193 }
194 }
195 return ids
196}
197
198func intersectSorted(a, b []uint32) []uint32 {
199 if len(a) == 0 || len(b) == 0 {

Callers 1

searchFuzzyFallbackFunction · 0.85

Calls 1

isSubsequenceFunction · 0.85

Tested by

no test coverage detected