diegoceccarelli commented on a change in pull request #300: SOLR-11831: Skip 
second grouping step if group.limit is 1 (aka Las Vegas Patch)
URL: https://github.com/apache/lucene-solr/pull/300#discussion_r290224198
 
 

 ##########
 File path: 
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
 ##########
 @@ -232,6 +233,45 @@ public void prepare(ResponseBuilder rb) throws IOException
     }
   }
 
+  private boolean allowSkipSecondGroupingStep(final SortSpec 
withinGroupSpecification, final SortSpec groupSort, final boolean isReranking) {
+    // Only possible if we only want one doc per group
+    final int limit =  withinGroupSpecification.getCount();
+    final int offset = withinGroupSpecification.getOffset();
+    if ( limit != 1 || offset != 0 ) {
+        log.error("group.skip.second.step=true is not compatible with 
group.limit (limit={}) ", limit);
+        return false;
+    }
+
+    // Within group sort must be the same as group sort because if we skip 
second step no sorting within group will be done.
+    if (withinGroupSpecification.getSort() !=  groupSort.getSort()) {
 
 Review comment:
   I agree, done in c5024d0

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to