You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/01/23 13:27:41 UTC

[09/51] lucene-solr:jira/solr-11714: SOLR-11846: Force BM25Similarity on TestFieldCacheSort.testFieldScoreReverse.

SOLR-11846: Force BM25Similarity on TestFieldCacheSort.testFieldScoreReverse.

This test expects scores to increase with freq, which not all similarities guarantee.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fa935cf6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fa935cf6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fa935cf6

Branch: refs/heads/jira/solr-11714
Commit: fa935cf6ac7a76042e5f5c6188719ab6a2cde429
Parents: 60c6890
Author: Adrien Grand <jp...@gmail.com>
Authored: Thu Jan 11 20:08:14 2018 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Thu Jan 11 20:08:14 2018 +0100

----------------------------------------------------------------------
 .../src/test/org/apache/solr/uninverting/TestFieldCacheSort.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fa935cf6/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
index 9588e67..2c0862f 100644
--- a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
+++ b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheSort.java
@@ -50,6 +50,7 @@ import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.similarities.BM25Similarity;
 import org.apache.lucene.store.Directory;
 import org.apache.solr.uninverting.UninvertingReader.Type;
 import org.apache.lucene.util.LuceneTestCase;
@@ -434,6 +435,8 @@ public class TestFieldCacheSort extends LuceneTestCase {
     writer.close();
     
     IndexSearcher searcher = newSearcher(ir);
+    // this test expects the freq to make doc 1 scores greater than doc 0
+    searcher.setSimilarity(new BM25Similarity());
     Sort sort = new Sort(new SortField(null, SortField.Type.SCORE, true));
 
     TopDocs actual = searcher.search(new TermQuery(new Term("value", "foo")), 10, sort);