You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When searching against a multi-valued field it is often advantageous to disable cross-matches. For instance, if a book contains two authors: "john smith" and "brian jones", a search for "john jones" should not match.
Currently the best workaround is to search using a sloppy phrase query. The drawback is that phrases are incompatible with other features such as wildcards and ranges. Additionally, it is left up to the user to know to formulate the query differently if searching a multi-valued field.
Here is an initial patch. Creating this was an adventure for me in learning some of Lucene's internals!
In this approach, ConjunctionScorer verifies that all of the matches' positions fall within the range of a user-supplied positionIncrementGap. Supported query types are: TermQuery, TermRangeQuery, PrefixQuery, PhraseQuery, WidlcardQuery, FuzzyQuery & BooleanQuery. A unit test is included demonstrating use with each of these query types.
All unit tests pass. However, there are some glaring inefficiencies in this initial impl attempt. Perhaps #3952 will ultimately provide much of the functionality otherwise implemented here (??). Also, should #3384 be implemented, there might be an opportunity to store a Field Type's PositionIncrementGap in the index, further lessening the burden on the user to correctly issue these types of queries.
When searching against a multi-valued field it is often advantageous to disable cross-matches. For instance, if a book contains two authors: "john smith" and "brian jones", a search for "john jones" should not match.
Currently the best workaround is to search using a sloppy phrase query. The drawback is that phrases are incompatible with other features such as wildcards and ranges. Additionally, it is left up to the user to know to formulate the query differently if searching a multi-valued field.
Migrated from LUCENE-3322 by James Dyer (@jdyer1)
Attachments: LUCENE-3322.patch
The text was updated successfully, but these errors were encountered: