LUCENE-7554: use BM25Similarity for this test

This commit is contained in:
Mike McCandless 2016-11-12 13:32:48 -05:00
parent 7523d580ed
commit 672d7e013e
1 changed files with 2 additions and 0 deletions

View File

@ -51,6 +51,7 @@ import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.highlight.DefaultEncoder;
import org.apache.lucene.search.highlight.Encoder;
import org.apache.lucene.search.similarities.BM25Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
@ -349,6 +350,7 @@ public class FastVectorHighlighterTest extends LuceneTestCase {
FastVectorHighlighter highlighter = new FastVectorHighlighter();
IndexReader reader = DirectoryReader.open(writer);
IndexSearcher searcher = newSearcher(reader);
searcher.setSimilarity(new BM25Similarity());
TopDocs hits = searcher.search(query, 10);
assertEquals(2, hits.totalHits);
FieldQuery fieldQuery = highlighter.getFieldQuery(query, reader);