You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/03/14 12:28:16 UTC

[GitHub] [lucene-solr] cpoerschke commented on a change in pull request #300: SOLR-11831: Skip second grouping step if group.limit is 1 (aka Las Vegas Patch)

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_r265544083
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
 ##########
 @@ -233,6 +233,41 @@ public void prepare(ResponseBuilder rb) throws IOException
     }
   }
 
+  private boolean allowSkipSecondGroupingStep(final GroupingSpecification groupingSpec, final boolean isReranking ) {
+    // Only possible if we only want one doc per group
+    if (groupingSpec.getGroupLimit() != 1) {
+        logger.error("group.skip.second.step=true is not compatible with group.limit == " + groupingSpec.getGroupLimit() );
+        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 (groupingSpec.getSortWithinGroup() !=  groupingSpec.getGroupSort()) {
+        logger.error("group.skip.second.step=true is not compatible with group.sort != sort");
+        return false;
+    }
+
+    boolean byRelevanceOnly = false;
+    SortField[] sortFields = groupingSpec.getGroupSort().getSort();
+
+    if(sortFields != null && sortFields.length == 1 && sortFields[0] != null && sortFields[0].getComparator() instanceof FieldComparator.RelevanceComparator) {
 
 Review comment:
   > Yeah, the PR went out of sync ...
   
   If you'd like https://github.com/bloomberg/lucene-solr/pull/228 pull request to merge into the https://github.com/bloomberg/lucene-solr/tree/SOLR-11831 branch (the branch behind this pull request here) has an interim 'make it compile (somehow)' change (also includes 'logger' to 'LOG' renames in this method).

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


With regards,
Apache Git Services

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