[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050316#comment-13050316 ]
Uwe Schindler commented on LUCENE-3208: --------------------------------------- I started to rewrite some stuff, very straightforward. - BufferedDeletesStream has to be changed as it was also calling Query.weight, but I replaced the usage here by QueryWrapperFilter and getting the DocIdSet. Code gets much easier here. - QueryWrapperFilter's hack was rewritten, easy - in TestFrameWork, QueryUtils were also rewritten, they often use weight, but thats internal only. The main issue: In IndexSearcher is already a method called createWeight(Query) (which currently delegates to the Query). I moved the code over here. I have to still complain about the name, it creates a Weight yes, but it should also note that it rewrites and normalizes the weight. So I would like to rename that method, too and deprecate the old one. For now I leave the name unchanged. Patch comes soon (core only). > Move Query.weight() to IndexSearcher as protected method > -------------------------------------------------------- > > Key: LUCENE-3208 > URL: https://issues.apache.org/jira/browse/LUCENE-3208 > Project: Lucene - Java > Issue Type: Bug > Components: core/search > Reporter: Uwe Schindler > Assignee: Uwe Schindler > Fix For: 3.3, 4.0 > > > We had this issue several times, latest in LUCENE-3207. > The method Query.weight() was left in Query for backwards reasons in Lucene > 2.9 when we changed Weight class. This method is only to be called on > top-level queries - and this is done by IndexSearcher. This method is just a > utility method, that has nothing to do with the query itsself (it just > combines the createWeight method and calls the normalization afterwards). > The problem we have is that any query that wraps other queries (like > CustomScore, ConstantScore, Boolean) calls Query.weight() instead of > Query.createWeight(), it will do normalization two times, leading to strange > bugs. > For 3.3 I will make Query.weight() simply delegate to IndexSearcher's > replacement method with a big deprecation warning, so user sees this. In > IndexSearcher itsself the method will be protected to only be called by > itsself or subclasses of IndexSearcher. Delegation for backwards is no > problem, as protected is accessible by classes in same package. > I would suggest the method name to be > IndexSearcher.createNormalizedWeight(Query q) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org