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_r293822041
 
 

 ##########
 File path: 
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
 ##########
 @@ -288,6 +328,13 @@ protected void prepareGrouping(ResponseBuilder rb) throws 
IOException {
     groupingSpec.setMain(params.getBool(GroupParams.GROUP_MAIN, false));
     groupingSpec.setNeedScore((rb.getFieldFlags() & 
SolrIndexSearcher.GET_SCORES) != 0);
     groupingSpec.setTruncateGroups(params.getBool(GroupParams.GROUP_TRUNCATE, 
false));
+
+    
groupingSpec.setSkipSecondGroupingStep(params.getBool(GroupParams.GROUP_SKIP_DISTRIBUTED_SECOND,
 false));
+    boolean isReranking = (rb.getRankQuery() != null);
+    if (groupingSpec.isSkipSecondGroupingStep() & 
!allowSkipSecondGroupingStep(groupingSpec.getWithinGroupSortSpec(), 
groupingSpec.getGroupSortSpec(), isReranking)){
 
 Review comment:
   The `QueryComponent.allowSkipSecondGroupingStep` method being passed and 
(almost) only using two of the `GroupingSpecification`'s parameters made me 
wonder if the allow logic might be moved into a `validate()` or similarly named 
method in that class -- 
https://github.com/cpoerschke/lucene-solr/commit/70e9c19ca5584be5c0666f70efea25b368a6f3b8
 has a sketch -- the logic being there would make it potentially available also 
to other non-`QueryComponent` plugins and the explicit 'optionally call 
validate after all the setters' aspect might also be helpful in terms of code 
comprehension. What do you think?

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