cpoerschke 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_r272684126
 
 

 ##########
 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:
   question/thought: is _full_ equality required technically speaking or would 
_prefix_ equality be sufficient? e.g. if the sorting within the group was by 
`X,Y,Z` and the sorting of groups was by `X,Y`. that way around in terms of 
prefixes, i think, or maybe the other way around.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to