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

Mark Miller commented on LUCENE-6220:
-------------------------------------

I put in this hack, and that led to a test fail mid way through - unfortunetly 
I've never seen this grouping code before.

{noformat}
Index: 
solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
===================================================================
--- 
solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
       (revision 1657874)
+++ 
solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
       (working copy)
@@ -173,7 +173,13 @@
 
         int topN = rb.getGroupingSpec().getOffset() + 
rb.getGroupingSpec().getLimit();
         final TopDocs mergedTopDocs;
-        if (sortWithinGroup == null) {
+        
+        boolean sort = false;
+        if (topDocs.size() > 0) {
+          sort = topDocs.get(0) instanceof TopFieldDocs;
+        }
+        
+        if (sortWithinGroup == null || !sort) {
           mergedTopDocs = TopDocs.merge(topN, topDocs.toArray(new 
TopDocs[topDocs.size()]));
         } else {
           mergedTopDocs = TopDocs.merge(sortWithinGroup, topN, 
topDocs.toArray(new TopFieldDocs[topDocs.size()]));
{noformat}

> Move needsScores from Weight.scorer to Query.createWeight
> ---------------------------------------------------------
>
>                 Key: LUCENE-6220
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6220
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: Trunk, 5.1
>
>         Attachments: LUCENE-6220.patch, LUCENE-6220.patch, LUCENE-6220.patch
>
>
> Whether scores are needed is currently a Scorer-level property while it 
> should actually be a Weight thing I think?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to