[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050296#comment-13050296 ] Robert Muir commented on LUCENE-3208: - +1 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050301#comment-13050301 ] Simon Willnauer commented on LUCENE-3208: - +1 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050382#comment-13050382 ] Michael McCandless commented on LUCENE-3208: +1 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 Attachments: LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050473#comment-13050473 ] Yonik Seeley commented on LUCENE-3208: -- +1, looks good! Doesn't seem like it's worth the trouble to catch Weight being normalized more than once. I'd say just commit this as is. 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 Attachments: LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050477#comment-13050477 ] Robert Muir commented on LUCENE-3208: - i think its worth the trouble, if we can do it. we shouldnt rely upon the fact that getting sumOfSquaredWeights in some of these weights currently has *side effects* and sometimes is just wasted computation. other times it creates wrong scores. 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 Attachments: LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050488#comment-13050488 ] Uwe Schindler commented on LUCENE-3208: --- A second idea would be that LuceneTestCase.newSearcher() returns such a Searcher, that wraps and disallows this. We have other helper classes like MockDirectory asserting similar things. I am currently thinking about coding this, its just a few lines. 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 Attachments: LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050498#comment-13050498 ] Robert Muir commented on LUCENE-3208: - bq. Wrapping every weight just makes things uglier, esp if you want to do something with the produced weight. It doesn't have to be done this way necessarily. Personally i would be happy if TermWeight had a boolean 'normalized' (used only for asserting) and an assert. it doesn't have to be totally perfect, but, I refuse to debug this issue again. If its not done here, I will open a blocker issue! 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 Attachments: LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050506#comment-13050506 ] Robert Muir commented on LUCENE-3208: - Great, Uwe, I'm satisfied. Sorry for being so vocal about this, but i wasted many hours on this stupid bug (I know you did before, too), and the bug is not very friendly to people that debug with System.out.println, you don't catch it until you pull out enough of your hair to start using Thread.dumpStack... 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 Attachments: LUCENE-3208-LTC.patch, LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050603#comment-13050603 ] Uwe Schindler commented on LUCENE-3208: --- Committed trunk revision: 1136568 Now backporting and adding sophisticated backwards... 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 Attachments: LUCENE-3208-LTC.patch, LUCENE-3208.patch, LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050654#comment-13050654 ] Uwe Schindler commented on LUCENE-3208: --- Missed a change in the new grouping module: Trunk revision: 1136605 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 Attachments: LUCENE-3208-LTC.patch, LUCENE-3208.patch, LUCENE-3208.patch, LUCENE-3208.patch 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
[jira] [Commented] (LUCENE-3208) Move Query.weight() to IndexSearcher as protected method
[ https://issues.apache.org/jira/browse/LUCENE-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13050764#comment-13050764 ] Robert Muir commented on LUCENE-3208: - the backport looks good, and important/scary to also fix this IndexSearcher/Searcher bug. 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 Attachments: LUCENE-3208-3x.patch, LUCENE-3208-3x.patch, LUCENE-3208-LTC.patch, LUCENE-3208.patch, LUCENE-3208.patch, LUCENE-3208.patch 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