(plan *queryPlan, snap *Snapshot, maxCheck int)
| 177 | } |
| 178 | |
| 179 | func 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 | |
| 198 | func intersectSorted(a, b []uint32) []uint32 { |
| 199 | if len(a) == 0 || len(b) == 0 { |
no test coverage detected