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

Mark Miller commented on LUCENE-1808:
-------------------------------------

I havn't yet figured out how to do this without breaking back compat  - I think 
this was an issue before as well. I'd have to dig it up, but some user 
complained about a similar issue when QueryWeight was put in.

If you add createQueryWeight as a public method, then all of the Lucene classes 
have to be changed to call it - otherwise, if you override it in a user Query, 
it won't be called on that Query.

But anyone with an external Query class that overrode createWeight will not 
call createQueryWeight, and won't work correctly with classes that override it. 
I guess if we make it final it would close that loop hole, but then thats a 
loss from createWeight where you could override, and is still a back compat 
break?

> make Query.createWeight public (or add back Query.createQueryWeight())
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-1808
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1808
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>    Affects Versions: 2.9
>            Reporter: Tim Smith
>            Assignee: Mark Miller
>
> Now that the QueryWeight class has been removed, the public QueryWeight 
> createQueryWeight() method on Query was also removed
> i have cases where i want to create a weight for a sub query (outside of the 
> org.apache.lucene.search package) and i don't want the weight normalized 
> (think BooleanQuery outside of the o.a.l.search package)
> in order to do this, i have to create a static Utils class inside 
> o.a.l.search, pass in the Query and searcher, and have the static method call 
> the protected createWeight method
> this should not be necessary
> This could be fixed in one of 2 ways:
> 1. make createWeight() public on Query (breaks back compat)
> 2. add the following method:
> {code}
> public Weight createQueryWeight(Searcher searcher) throws IOException {
>   return createWeight(searcher);
> }
> {code}
> createWeight(Searcher) should then be deprectated in favor of the publicly 
> accessible method

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to