From 3d0875f80ae9351e348994f8bd08dd2f05e6a99f Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 21 Mar 2014 14:48:00 +0000 Subject: [PATCH] LUCENE-5489: fix test bug git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1579948 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/org/apache/lucene/search/TestQueryRescorer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java b/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java index 6e1847598cc..71b8ddca25c 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java @@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause.Occur; +import org.apache.lucene.search.similarities.DefaultSimilarity; import org.apache.lucene.search.spans.SpanNearQuery; import org.apache.lucene.search.spans.SpanQuery; import org.apache.lucene.search.spans.SpanTermQuery; @@ -53,6 +54,9 @@ public class TestQueryRescorer extends LuceneTestCase { bq.add(new TermQuery(new Term("field", "oz")), Occur.SHOULD); IndexSearcher searcher = newSearcher(r); + // We rely on more tokens = lower score: + searcher.setSimilarity(new DefaultSimilarity()); + TopDocs hits = searcher.search(bq, 10); assertEquals(2, hits.totalHits); assertEquals("0", searcher.doc(hits.scoreDocs[0].doc).get("id"));