LUCENE-5489: fix test bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1579948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-03-21 14:48:00 +00:00
parent 9f7d52ca2e
commit 3d0875f80a
1 changed files with 4 additions and 0 deletions

View File

@ -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"));