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
>
>

Reply via email to