LUCENE-8652: ensure that the norm doesn't influence the score in TestSynonymQuery#testBoosts

This commit is contained in:
jimczi 2019-03-12 09:33:40 +01:00
parent fd8d9d5199
commit c87e7614f1
1 changed files with 5 additions and 4 deletions

View File

@ -37,6 +37,7 @@ import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.similarities.BM25Similarity;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
@ -168,20 +169,20 @@ public class TestSynonymQuery extends LuceneTestCase {
w.addDocument(doc); w.addDocument(doc);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
doc.clear(); doc.clear();
doc.add(new TextField("f", "a a a a", Store.NO)); doc.add(new Field("f", "a a a a", ft));
w.addDocument(doc); w.addDocument(doc);
if (i % 2 == 0) { if (i % 2 == 0) {
doc.clear(); doc.clear();
doc.add(new TextField("f", "b b", Store.NO)); doc.add(new Field("f", "b b", ft));
w.addDocument(doc); w.addDocument(doc);
} else { } else {
doc.clear(); doc.clear();
doc.add(new TextField("f", "a a b", Store.NO)); doc.add(new Field("f", "a a b", ft));
w.addDocument(doc); w.addDocument(doc);
} }
} }
doc.clear(); doc.clear();
doc.add(new TextField("f", "c", Store.NO)); doc.add(new Field("f", "c", ft));
w.addDocument(doc); w.addDocument(doc);
IndexReader reader = w.getReader(); IndexReader reader = w.getReader();
IndexSearcher searcher = newSearcher(reader); IndexSearcher searcher = newSearcher(reader);