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_r321740457
########## File path: lucene/grouping/src/java/org/apache/lucene/search/grouping/FirstPassGroupingCollector.java ########## @@ -139,10 +139,18 @@ public ScoreMode scoreMode() { // System.out.println(" group=" + (group.groupValue == null ? "null" : group.groupValue.toString())); SearchGroup<T> searchGroup = new SearchGroup<>(); searchGroup.groupValue = group.groupValue; + // We pass this around so that we can get the corresponding solr id when serializing the search group to send to the federator + searchGroup.topDocLuceneId = group.topDoc; searchGroup.sortValues = new Object[sortFieldCount]; for(int sortFieldIDX=0;sortFieldIDX<sortFieldCount;sortFieldIDX++) { searchGroup.sortValues[sortFieldIDX] = comparators[sortFieldIDX].value(group.comparatorSlot); } + // TODO: It should be possible to extend this to handle more than one FieldComparator and other types Review comment: TODO item here w.r.t. sort field count being one. If it's not too difficult extending to multiples might be nice to do, or it could be deferred until later (and `GroupingSpecification.validate` would for now throw if there's more than one). Either way let's add test coverage and documentation. Semi-related, the https://lucene.apache.org/solr/guide/8_1/common-query-parameters.html#sort-parameter documentation reminded me that sorting by functions is possible. If (as the code snippet here seems to suggest) `group.skip.second.step=true` currently assumes that the sort element is a field (and not a function) then let's include that in the documentation, validation code and test coverage. Support for the not-yet-supported things could of course be added subsequently in future. Does that kind of make sense? ---------------------------------------------------------------- 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