[ 
https://issues.apache.org/jira/browse/LUCENE-6590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adrien Grand updated LUCENE-6590:
---------------------------------
    Attachment: LUCENE-6590.patch

New iteration that removes queryBoost from createWeight and applies both the 
query and the parent boost through Weight.normalize. Here is how it works:

  1. Weight.normalize is called a query norm of 1 and the query boost
  2. Weight.getValueForNormalization (which may take the query boost into 
account) is called to compute queryNorm
  3. Weight.normalize is called again with queryNorm and a boost which is equal 
to the query boost multiplied by the boost which is propagated by parent 
queries.

The patch still only touches lucene/core. There is some documentation that 
needs to be updated, etc. but if someone could look at the API and how boosts 
are applied, that would be great. When we are happy with the approach then I 
can spend time fixing modules as well.

> 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
>         Attachments: LUCENE-6590.patch, LUCENE-6590.patch
>
>
> 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]

Reply via email to