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_r321726345
##########
File path: solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
##########
@@ -425,6 +426,65 @@ public void test() throws Exception {
//Debug
simpleQuery("q", "*:*", "rows", 10, "fl", "id," + i1, "group", "true",
"group.field", i1, "debug", "true");
+ doTestGroupSkipSecondStep();
+ }
+
+ /*
+ SOLR-11831, test skipping the second grouping step if the query only
retrieves on document per group
+ */
+ private void doTestGroupSkipSecondStep() throws Exception {
+ ignoreException(GroupParams.GROUP_SKIP_DISTRIBUTED_SECOND); // don't print
stack trace for exception raised by group.skip.second.step
+ // Ignore numFound if group.skip.second.step is enabled because the number
of documents per group will not be computed (will default to 1)
+ handle.put("numFound", SKIP);
+ query("q", "{!func}id_i1", "rows", 3, "group.skip.second.step", true,
"group.limit", 1, "fl", "id," + i1, "group", "true",
+ "group.field", i1);
+ query("q", "kings", "group.skip.second.step", true, "fl", "id," + i1,
"group", "true", "group.field", i1);
Review comment:
The intent of the two `{!func}id_i1` tests
```
query("q", "{!func}id_i1", "rows", 3, "group.skip.second.step", true,
"group.limit", 1, "fl", "id," + i1, "group", "true", "group.field", i1);
...
query("q", "{!func}id_i1", "rows", 3, "group.skip.second.step", true, "fl",
"id," + i1, "group", "true", "group.field", i1);
```
looks to be related to the `group.limit` parameter's absence or presence
(with value `1`). The recently added `variantQuery` helper method could
potentially make that intent clearer, assuming that was the intent.
https://github.com/cpoerschke/lucene-solr/commit/3690cb3d4ed537546d2d876eb00dcc0fb735a557
as some scribbles in the `doTestGroupSkipSecondStepAlt` method. 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]