[
https://issues.apache.org/jira/browse/LUCENE-6590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14593583#comment-14593583
]
Robert Muir commented on LUCENE-6590:
-------------------------------------
If we just removed Query.get/setBoost and replaced with something like
BoostQuery(Query q, float boost) then it could simplify some APIs in scoring as
well.
Today we already have to handle the case of 2 different boosts (boosts coming
from parent queries in Weight.normalize, and also the leaf's own Query.boost).
It makes things confusing in Weight/Similarity.normalize() where they must deal
with these 2 separate boosts and combine them to one.
So this could all be removed and reduced to boosts handled via one codepath in
Weight:
{code}
/** Assigns the query normalization factor and boost to this. */
public abstract void normalize(float norm, float boost);
{code}
That is in addition to reducing the possibility of bugs like forgetting to use
boost higher up the stack, which I think is very common.
> Explore different ways to apply boosts
> --------------------------------------
>
> Key: LUCENE-6590
> URL: https://issues.apache.org/jira/browse/LUCENE-6590
> Project: Lucene - Core
> Issue Type: Wish
> Reporter: Adrien Grand
> Priority: Minor
>
> Follow-up from LUCENE-6570: the fact that all queries are mutable in order to
> allow for applying a boost raises issues since it makes queries bad cache
> keys since their hashcode can change anytime. We could just document that
> queries should never be modified after they have gone through IndexSearcher
> but it would be even better if the API made queries impossible to mutate at
> all.
> I think there are two main options:
> - either replace "void setBoost(boost)" with something like "Query
> withBoost(boost)" which would return a clone that has a different boost
> - or move boost handling outside of Query, for instance we could have a
> (immutable) query impl that would be dedicated to applying boosts, that
> queries that need to change boosts at rewrite time (such as BooleanQuery)
> would use as a wrapper.
> The latter idea is from Robert and I like it a lot given how often I either
> introduced or found a bug which was due to the boost parameter being ignored.
> Maybe there are other options, but I think this is worth exploring.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]