Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor percolator's QueryAnalyzer to use QueryVisitors #49300

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

romseygeek
Copy link
Contributor

Lucene now allows us to explore the structure of a query using QueryVisitors,
delegating the knowledge of how to recurse through and collect terms to the
query implementations themselves. The percolator currently has a home-grown
external version of this API to construct sets of matching terms that must be
present in a document in order for it to possibly match the query.

This commit removes the home-grown implementation in favour of one using
QueryVisitor. This has the added benefit of making interval queries available
for percolator pre-filtering. Due to a bug in multi-term intervals (LUCENE-9050)
it also includes a clone of some of the lucene intervals logic, that can be removed
once upstream has been fixed.

Closes #45639

…isitors,

delegating the knowledge of how to recurse through and collect terms to the
query implementations themselves. The percolator currently has a home-grown
external version of this API to construct sets of matching terms that must be
present in a document in order for it to possibly match the query.

This commit removes the home-grown implementation in favour of one using
QueryVisitor. This has the added benefit of making interval queries available
for percolator pre-filtering. Due to a bug in multi-term intervals (LUCENE-9050)
it also includes a clone of some of the lucene intervals logic, that can be removed
once upstream has been fixed.

Closes elastic#45639
@romseygeek romseygeek added >enhancement :Search Relevance/Percolator Reverse search: find queries that match a document backport v7.6.0 labels Nov 19, 2019
@romseygeek romseygeek requested a review from martijnvg November 19, 2019 11:57
@romseygeek romseygeek self-assigned this Nov 19, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Percolator)

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@romseygeek romseygeek merged commit c6b3116 into elastic:7.x Nov 20, 2019
@romseygeek romseygeek deleted the percolator-visitor-7x branch November 20, 2019 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport >enhancement :Search Relevance/Percolator Reverse search: find queries that match a document v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants