[ 
https://issues.apache.org/jira/browse/LUCENE-5222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770831#comment-13770831
 ] 

Robert Muir commented on LUCENE-5222:
-------------------------------------

{quote}
If I add the last two boolean values explicitly as true (doDocScores and 
doMaxScore) to both search() and searchAfter() calls, the test succeeds
{quote}

Indeed: I just tested this and it works (see patch below)

Additionally i noticed TestSearchAfter in core somehow "hides the bug" with 
this stuff in its test:
{noformat}
if (sort == Sort.RELEVANCE) {
         paged = searcher.searchAfter(lastBottom, query, filter, pageSize, 
sort, true, doMaxScore);
{noformat}

So there is a bug here in searchAfter/TopFieldCollector, and i'm also unhappy 
TestSearchAfter is not testing multiple sorts!


{noformat}
Index: src/test/org/apache/lucene/expressions/TestExpressionSorts.java
===================================================================
--- src/test/org/apache/lucene/expressions/TestExpressionSorts.java     
(revision 1524082)
+++ src/test/org/apache/lucene/expressions/TestExpressionSorts.java     
(working copy)
@@ -131,7 +131,10 @@
 
   void assertQuery(Query query, Filter filter, Sort sort) throws Exception {
     int size = _TestUtil.nextInt(random(), 1, 
searcher.getIndexReader().maxDoc()/5);
-    TopDocs expected = searcher.search(query, filter, size, sort, 
random().nextBoolean(), random().nextBoolean());
+    // consume randomness
+    random().nextBoolean();
+    random().nextBoolean();
+    TopDocs expected = searcher.search(query, filter, size, sort, true, false);
     
     // make our actual sort, mutating original by replacing some of the 
     // sortfields with equivalent expressions
@@ -152,12 +155,15 @@
     }
     
     Sort mutatedSort = new Sort(mutated);
-    TopDocs actual = searcher.search(query, filter, size, mutatedSort, 
random().nextBoolean(), random().nextBoolean());
+    // consume randomness
+    random().nextBoolean();
+    random().nextBoolean();
+    TopDocs actual = searcher.search(query, filter, size, mutatedSort, true, 
false);
     CheckHits.checkEqual(query, expected.scoreDocs, actual.scoreDocs);
     
     if (size < actual.totalHits) {
-      expected = searcher.searchAfter(expected.scoreDocs[size-1], query, 
filter, size, sort);
-      actual = searcher.searchAfter(actual.scoreDocs[size-1], query, filter, 
size, mutatedSort);
+      expected = searcher.searchAfter(expected.scoreDocs[size-1], query, 
filter, size, sort, true, false);
+      actual = searcher.searchAfter(actual.scoreDocs[size-1], query, filter, 
size, mutatedSort, true, false);
       CheckHits.checkEqual(query, expected.scoreDocs, actual.scoreDocs);
     }
   }
{noformat}
                
> TestExpressionSorts fails sometimes when using expression returning score
> -------------------------------------------------------------------------
>
>                 Key: LUCENE-5222
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5222
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Ryan Ernst
>
> Jenkins picked this up.  Repeat with:
> {code}
> ant test  -Dtestcase=TestExpressionSorts -Dtests.method=testQueries 
> -Dtests.seed=115AD00ED89D9F7B -Dtests.multiplier=3 -Dtests.slow=true 
> -Dtests.locale=no_NO -Dtests.timezone=America/Nassau 
> -Dtests.file.encoding=US-ASCII
> {code}
> It appears to have to do with scoring, as removing the score sort from the 
> original sorts causes the tests to pass.  If you remove the possible 
> discrepancy between doDocScores and docMaxScore params to searcher.search, 
> then the test gets farther before failing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to