-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Enable BoostingQuery with FVH highlighter #19984
Conversation
@@ -56,6 +58,11 @@ public CustomFieldQuery(Query query, IndexReader reader, boolean phraseHighlight | |||
|
|||
@Override | |||
void flatten(Query sourceQuery, IndexReader reader, Collection<Query> flatQueries, float boost) throws IOException { | |||
while (sourceQuery instanceof BoostQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When BoostQuery
need to parse to other query firstly, because BoostQuery
also can have BoostingQuery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CustomFieldQuery
is only for FastVectorHighlighter
usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why you used while
here instead of if
like the rest of the cases. Do we usually have multiple layers of BoostQuery
when we have a single layer? Could you push a patch with a comment about it or switch it to the normal if
statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, After investigation, there is no directly BoostQueryBuilder
api, so it should not have multiple
layers BootQuery
(recursive BoostQuery
).
If in future there are multi layer BoostQuery
, I think this should be call out. :)
@@ -75,6 +82,10 @@ void flatten(Query sourceQuery, IndexReader reader, Collection<Query> flatQuerie | |||
} else if (sourceQuery instanceof ToParentBlockJoinQuery) { | |||
ToParentBlockJoinQuery blockJoinQuery = (ToParentBlockJoinQuery) sourceQuery; | |||
flatten(blockJoinQuery.getChildQuery(), reader, flatQueries, boost); | |||
} else if (sourceQuery instanceof BoostingQuery) { | |||
BoostingQuery boostingQuery = (BoostingQuery) sourceQuery; | |||
flatten(boostingQuery.getContext(), reader, flatQueries, boostingQuery.getBoost()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be boost * boostingQuery.getBoost()
? I think that is closer to the way that the boosts are applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, Yeah, I will update, Thanks
It was an oversight. A leftover during the Lucene upgrade I believe. |
OK! All tests passed locally. Merged. Thanks agains @chengpohi ! |
This PR is for enable boosting query with FVH highlighter.
#19985