MCPcopy Create free account
hub / github.com/coder/coder / countBoundaryHits

Function countBoundaryHits

agent/filefinder/text.go:206–220  ·  view source on GitHub ↗
(path []byte, query []byte)

Source from the content-addressed store, hash-verified

204}
205
206func countBoundaryHits(path []byte, query []byte) int {
207 if len(query) == 0 || len(path) == 0 {
208 return 0
209 }
210 hits := 0
211 qi := 0
212 for pi := 0; pi < len(path) && qi < len(query); pi++ {
213 atBoundary := pi == 0 || isBoundary(path[pi-1])
214 if atBoundary && toLowerASCII(path[pi]) == toLowerASCII(query[qi]) {
215 hits++
216 qi++
217 }
218 }
219 return hits
220}
221
222func equalFoldASCII(a, b []byte) bool {
223 if len(a) != len(b) {

Callers 1

scorePathFunction · 0.85

Calls 2

isBoundaryFunction · 0.85
toLowerASCIIFunction · 0.85

Tested by

no test coverage detected