[
https://issues.apache.org/jira/browse/LUCENE-6590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adrien Grand updated LUCENE-6590:
---------------------------------
Attachment: LUCENE-6690.patch
Here is a patch that iterates over the previous one but for the entire code
base. Overall, I think I like this change for several reasons:
- Query rewriting is much easier as you don't need to care about boosts (I'm
pretty sure the patch fixes some boost handling)
- Queries don't need to incorporate the boost in their toString()
representation
- it removed the {{queryBoost}} parameter from Similarities and the top level
boost and query boost are now applied the same way
- it removed several APIs: Query.setBoost, Query.getBoost, Query.clone without
adding new ones, we just have two additional query implementations: BoostQuery
and SpanBoostQuery
- It allows queries to be fully immutable, ie. we don't need to clone anymore
when planning to use a Query as a cache key.
The only downside I see is for the highlighting module: it has to deconstruct
queries to understand how they are formed, and this new additional BoostQuery
required to add a bit more unwrapping. However, I think the benefits outweight
this slight inconvenience.
Any opinions?
> 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, LUCENE-6690.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]