[
https://issues.apache.org/jira/browse/LUCENE-6328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14350561#comment-14350561
]
Paul Elschot edited comment on LUCENE-6328 at 3/6/15 4:49 PM:
--------------------------------------------------------------
I am probably late with this, but anyway. Using a stricter result type
(subclass of the result type) in a subclass method was not available in Java at
the time of LUCENE-1518, but it is now.
That means that there is an alternative that was not available at the time of
LUCENE-1518, and that is to make Weight a subclass of Filter. This involves
using the same method in Weight to return a Scorer as the method that is/was
used in Filter to return a DISI.
I have not tried this, but my guess is that this approach will simplify the
code in many places.
was (Author: [email protected]):
I am probably late with this, but anyway. Using a stricter result type
(subclass of the result type) in a subclass method was not available in Java at
the time of LUCENE-1518, but it is now.
That means that there is an alternative that was not available at the time of
LUCENE-1518, and that is to make Weight a subclass of Filter. This involves
using the same method in Weight to return a Scorer as the method that is used
in Filter to return a DISI.
I have not tried this, but my guess is that this approach will simplify the
code in many places.
> 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
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]