0
0
bleve/search/searcher
Steve Yen d425a3be86 scorch fix disjunction searcher Advance()
Found with "versus" test (TestScorchVersusUpsideDownBoltSmallMNSAM),
which had a boolean query with a MustNot that was the same as the Must
parameters.  This replicates a situation found by
Aruna/Mihir/testrunner/RQG (MB-27291).  Example:

  "query": {
    "must_not": {"disjuncts": [
      {"field": "body", "match": "hello"}
    ]},
    "must": {"conjuncts": [
      {"field": "body", "match": "hello"}
    ]}
  }

The nested searchers along the MustNot pathway would end up looking
roughly like...

  booleanSearcher
    MustNot
      => disjunctionSearcher
         => disjunctionSearcher
            => termSearcher

On the first Next() call by the collector, the two disjunction
searchers would run through their respective Next() method processing,
which includes their initSearcher() processing on the first time.
This has the effect of driving the leaf termSearcher through two
Next() invocations.

That is, if there were 3 docs (doc-1, doc-2, doc-3), the leaf
termSearcher would at this point have moved to point to doc-3, while
the topmost MustNot would have received doc-1.

Next, the booleanSearcher's Must searcher would produce doc-2, so the
booleanSearcher would try to Advance() the MustNot searcher to doc-2.

But, in scorch, the leafmost termSearcher had already gotten past
doc-2 and would return its doc-3.

In upsidedown, in contrast, the leaf termSearcher would then drive the
KVStore iterator with a Seek(doc-2), and the KVStore iterator would
perform a backwards seek to reach doc-2.

In scorch, however, backwards iteration seeking isn't supported.

So, this fix checks the state of the disjunction searcher to see if we
already have the necessary state so that we don't have to perform
actual Advance()'es on the underlying searchers.  This not only fixes
the behavior w.r.t. scorch, but also can have an effect of potentially
making upsidedown slightly faster as we're avoiding some backwards
KVStore iterator seeks.
2017-12-21 18:20:04 -08:00
..
base_test.go actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
ordered_searchers_list.go actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
search_boolean_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_boolean.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_conjunction_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_conjunction.go children of conjunct/disjunct's are not necessarily termSearchers 2017-12-21 16:45:43 -08:00
search_disjunction_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_disjunction.go scorch fix disjunction searcher Advance() 2017-12-21 18:20:04 -08:00
search_docid_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_docid.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_filter.go add experimental support for indexing/query geo points 2017-03-24 17:22:21 -07:00
search_fuzzy_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_fuzzy.go add option for multi term searcher to skip max disjunction check 2017-04-04 10:46:57 -04:00
search_geoboundingbox_test.go geo review comments from sreekanth 2017-03-31 08:41:40 -04:00
search_geoboundingbox.go add option for multi term searcher to skip max disjunction check 2017-04-04 10:46:57 -04:00
search_geopointdistance_test.go improved geo searcher unit tests 2017-03-29 16:57:58 -04:00
search_geopointdistance.go fix geo point distance search 2017-04-27 17:28:07 -04:00
search_match_all_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_match_all.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_match_none_test.go actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
search_match_none.go actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
search_multi_term.go add option for multi term searcher to skip max disjunction check 2017-04-04 10:46:57 -04:00
search_numeric_range_test.go actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
search_numeric_range.go fix issue with numeric range queries in query string 2017-06-06 16:03:05 -04:00
search_phrase_test.go phrase searcher now supports multi-phrase 2017-02-10 15:17:50 -05:00
search_phrase.go added stringer method to phrase part 2017-09-01 09:16:08 -04:00
search_regexp_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_regexp.go add option for multi term searcher to skip max disjunction check 2017-04-04 10:46:57 -04:00
search_term_prefix.go add option for multi term searcher to skip max disjunction check 2017-04-04 10:46:57 -04:00
search_term_range_test.go fix panic in term range search 2017-05-05 23:13:04 -04:00
search_term_range.go fix panic in term range search 2017-05-05 23:13:04 -04:00
search_term_test.go API change: optional SearchRequest.IncludeLocations flag 2017-01-05 21:11:22 -08:00
search_term.go refactor searchers 2017-03-31 17:21:46 -04:00