0
0
bleve/search
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
..
collector Merge pull request #564 from steveyen/master 2017-04-29 19:48:52 -04:00
facet reduce garbage created while processing facets 2017-03-02 17:00:46 -05:00
highlight remove use of float64 to represent int things 2017-02-09 20:15:59 -05:00
query Allow pre parsing query strings 2017-04-25 16:30:47 +02:00
scorer refactor searchers 2017-03-31 17:21:46 -04:00
searcher scorch fix disjunction searcher Advance() 2017-12-21 18:20:04 -08:00
collector.go nicer formatting of license header 2016-10-02 10:13:14 -04:00
explanation.go nicer formatting of license header 2016-10-02 10:13:14 -04:00
facets_builder_test.go numeric range facet merging compare range values not pointers 2016-11-03 15:48:46 -04:00
facets_builder.go reduce garbage created while processing facets 2017-03-02 17:00:46 -05:00
levenshtein_test.go removed extra ptr indirection from LevenshteinDistance 2016-10-11 08:49:10 -07:00
levenshtein.go removed extra ptr indirection from LevenshteinDistance 2016-10-11 08:49:10 -07:00
pool_test.go fix misspellings 2016-10-02 12:11:15 -04:00
pool.go DocumentMatchPool hits allocator outside of loop 2017-02-06 14:26:59 -08:00
search.go import couchbase/vellum instead of couchbaselabs/vellum 2017-12-19 10:49:57 -08:00
sort.go Exposing lon/lat fields in SortGeoDistance struct 2017-05-22 11:51:37 +05:30
util_test.go nicer formatting of license header 2016-10-02 10:13:14 -04:00
util.go nicer formatting of license header 2016-10-02 10:13:14 -04:00