Hello Adrian, I haven't implemented rewrite at all. I think something else is wrong in my approach and adding to the confusion. I override protected AcceptStatus acceptPosition(Spans spans). In there, i conditionally call setBoost() myself because originally i wanted to decrease the boost for each subsequent call to acceptPosition (meaning AcceptStatus.NO is returned). Because of LUCENE-6590, and as i understand from other discussions, you guys wanted Query to be immutable so i should not change the setBoost.
How can i now, change the boost conditionally from inside acceptPosition()? Is rewrite going to be called at some point where i can return a new Query object with decreased boost? Thanks, Markus -----Original message----- > From:Adrien Grand <jpou...@gmail.com> > Sent: Thursday 17th December 2015 14:40 > To: solr-user <solr-u...@lucene.apache.org>; java-user@lucene.apache.org > Subject: Re: propagate Query.rewrite call to super.rewrite after 5.4 upgrade > > Hi Markus, > > This is indeed related to LUCENE-6590: query boosts are now applied with > BoostQuery and if Query.setBoost is called on a query, its rewrite > implementation needs to rewrite to a BoostQuery. You can do that by > prepending the following to your rewrite(IndexReader) implementation: > > if (getBoost() != 1f) { return super.rewrite(reader); } > > > Le jeu. 17 déc. 2015 à 13:23, Markus Jelsma <markus.jel...@openindex.io> a > écrit : > > > Hi, > > > > Apologies for the cross post. We have a class overridding > > SpanPositionRangeQuery. It is similar to a SpanFirst query but it is > > capable of adjusting the boost value with regard to distance. With the 5.4 > > upgrade the unit tests suddenly threw the following exception: > > > > Query class org.GrSpanFirstQuery does not propagate Query.rewrite call to > > super.rewrite > > at > > __randomizedtesting.SeedInfo.seed([CA3D7CF96D5E8E7:88BE883E6CA09E3F]:0) > > at junit.framework.Assert.fail(Assert.java:57) > > at junit.framework.Assert.assertTrue(Assert.java:22) > > at org.apache.lucene.search.QueryUtils.check(QueryUtils.java:73) > > at > > org.apache.lucene.search.AssertingIndexSearcher.rewrite(AssertingIndexSearcher.java:83) > > at > > org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:886) > > at > > org.apache.lucene.search.AssertingIndexSearcher.createNormalizedWeight(AssertingIndexSearcher.java:58) > > at > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535) > > at > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:744) > > at > > org.apache.lucene.search.IndexSearcher.searchAfter(IndexSearcher.java:460) > > at > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:489) > > > > I tracked it down to LUCENE-6590 - Explore different ways to apply boosts, > > but the solution did not really pop in my head right away. Implementing > > rewrite does not seem to change anything. Everything fails in the unit test > > at the point i want to retrieve docs and assert their positions in the > > result set: ScoreDoc[] docs = searcher.search(spanfirstquery, 10).scoreDocs; > > > > I am probably missing something but any ideas to share? > > > > Many thanks! > > Markus > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org