[ 
https://issues.apache.org/jira/browse/LUCENE-6328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14352033#comment-14352033
 ] 

Paul Elschot commented on LUCENE-6328:
--------------------------------------

I took this a little further, and then I ran into the still incomplete Weight 
needsScores implementation. For example SpanWeight does not yet have a 
needsScores argument, and IndexSearcher.createNormalizedWeight can be called 
with needsScores == false, but in that case there is no point normalization.

To conclude, it might be nice to make Weight a subclass of DocIdSet, but at the 
moment there is no real need for this, unless someone needs to cache docids and 
score values and reuse the current docidset caches for that.

Other than that, doing this would not bring functionality that is not currently 
available: mostly QueryWrapperFilter (Query to Filter) and ConstantScoreQuery 
(Filter to Query) work well already, leaving the actual class structure 
underlying Query and Filter less important.

> Make Filter.clone and Filter.setBoost throw an UnsupportedOperationException
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-6328
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6328
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: Trunk, 5.1
>
>         Attachments: LUCENE-6328.patch, queryextendsfilter-20150307.patch, 
> queryextendsfilter-20150307b.patch
>
>
> The rewrite process uses a combination of calls to clone() and 
> setBoost(boost) in order to rewrite queries. This is a bit weird for filters 
> given that they were not originally designed to care about scoring.
> Using a filter directly as a query fails unit tests today since filters do 
> not pass the QueryUtils checks: it is expected that cloning and changing the 
> boost results in an instance which is unequal. However existing filters do 
> not take into account the getBoost() parameter inherited from Query so this 
> test fails.
> I think it would be less error-prone to throw an 
> UnsupportedOperationException for clone() and setBoost() on filters and 
> disable the check in QueryUtils for filters.
> In order to keep rewriting working, filters could rewrite to a CSQ around 
> themselves so that clone() and setBoost() would be called on the CSQ.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to