[ https://issues.apache.org/jira/browse/LUCENE-2869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-2869: -------------------------------- Attachment: LUCENE-2869.patch Here's a patch. To fix the BoostingQuery in contrib, it overrides BooleanWeight. (Also a test that instantiates BooleanScorer with a null weight had to be fixed). > remove Query.getSimilarity() > ---------------------------- > > Key: LUCENE-2869 > URL: https://issues.apache.org/jira/browse/LUCENE-2869 > Project: Lucene - Java > Issue Type: Task > Reporter: Robert Muir > Attachments: LUCENE-2869.patch > > > Spinoff of LUCENE-2854. > See LUCENE-2828 and LUCENE-2854 for reference. > In general, the SimilarityDelegator was problematic with regards to > back-compat, and if queries > want to score differently, trying to runtime subclass Similarity only causes > trouble. > The reason we could not fix this in LUCENE-2854 is because: > {noformat} > Michael McCandless added a comment - 08/Jan/11 01:53 PM > bq. Is it possible to remove this method Query.getSimilarity also? I don't > understand why we need this method! > I would love to! But I think that's for another day... > I looked into this and got stuck with BoostingQuery, which rewrites to an > anon > subclass of BQ overriding its getSimilarity in turn override its coord > method. > Rather twisted... if we can do this differently I think we could remove > Query.getSimilarity. > {noformat} > here is the method in question: > {noformat} > /** Expert: Returns the Similarity implementation to be used for this query. > * Subclasses may override this method to specify their own Similarity > * implementation, perhaps one that delegates through that of the Searcher. > * By default the Searcher's Similarity implementation is returned.*/ > public Similarity getSimilarity(IndexSearcher searcher) { > return searcher.getSimilarity(); > } > {noformat} -- 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: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org