@@ -21,9 +21,7 @@ import (
2121 "hash/crc64"
2222 "log"
2323 "math/bits"
24- "os"
2524 "slices"
26- "strconv"
2725 "unicode/utf8"
2826
2927 "github.com/sourcegraph/zoekt/query"
@@ -403,37 +401,11 @@ func (r *ngramIterationResults) candidates() []*candidateMatch {
403401 return cs
404402}
405403
406- // experimentIterateNgramLookupLimit when non-zero will only lookup this many
407- // ngrams from a query string. Note: that if case-insensitive, this only
408- // limits the input. So we will still lookup the case folding.
409- //
410- // This experiment is targetting looking up large snippets. If it is
411- // successful, we will likely hardcode the value we use in production.
412- //
413- // Future note: if we find cases where this works badly, we can consider only
414- // searching a random subset of the query string to avoid bad strings.
415- var experimentIterateNgramLookupLimit = getEnvInt ("SRC_EXPERIMENT_ITERATE_NGRAM_LOOKUP_LIMIT" )
416-
417- func getEnvInt (k string ) int {
418- v , _ := strconv .Atoi (os .Getenv (k ))
419- if v != 0 {
420- log .Printf ("%s = %d\n " , k , v )
421- }
422- return v
423- }
424-
425404func (d * indexData ) iterateNgrams (query * query.Substring ) (* ngramIterationResults , error ) {
426405 str := query .Pattern
427406
428407 // Find the 2 least common ngrams from the string.
429- var ngramOffs []runeNgramOff
430- if ngramLimit := experimentIterateNgramLookupLimit ; ngramLimit > 0 {
431- // Note: we can't just do str = str[:ngramLimit] due to utf-8 and str
432- // length is asked later on for other optimizations.
433- ngramOffs = splitNGramsLimit ([]byte (str ), ngramLimit )
434- } else {
435- ngramOffs = splitNGrams ([]byte (str ))
436- }
408+ ngramOffs := splitNGrams ([]byte (str ))
437409
438410 // protect against accidental searching of empty strings
439411 if len (ngramOffs ) == 0 {
0 commit comments