Copilot commented on code in PR #4495:
URL: https://github.com/apache/solr/pull/4495#discussion_r3340728959


##########
solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java:
##########
@@ -145,54 +123,55 @@ protected String getShardsString() {
   }
 
   /**
-   * Tests multiple lexical queries using the distributed solr client.
+   * Tests all combined query variants (single lexical, multiple lexical, 
sort, pagination,
+   * faceting, facet+highlighting) against the same 10-document index.
    *
    * @throws Exception if any error occurs during the test execution
    */
   @Test
-  public void testMultipleLexicalQuery() throws Exception {
+  public void testCombinedQueries() throws Exception {
     prepareIndexDocs();
-    String jsonQuery =
+
+    // single lexical query
+    QueryResponse rsp =
+        query(
+            CommonParams.JSON,
+            "{\"queries\":"
+                + "{\"lexical1\":{\"lucene\":{\"query\":\"id:2^10\"}}},"
+                + "\"limit\":5,"
+                + "\"fields\":[\"id\",\"score\",\"title\"],"
+                + 
"\"params\":{\"combiner\":true,\"combiner.query\":[\"lexical1\"]}}",
+            CommonParams.QT,
+            "/search");
+    assertEquals(1, rsp.getResults().size());
+    assertFieldValues(rsp.getResults(), id, "2");
+
+    // multiple lexical queries
+    String multiQuery =
         "{\"queries\":"
             + "{\"lexical1\":{\"lucene\":{\"query\":\"id:(2^2 OR 3^1 OR 6^2 OR 
5^1)\"}},"
             + "\"lexical2\":{\"lucene\":{\"query\":\"id:(4^1 OR 5^2 OR 7^3 OR 
10^2)\"}}},"
             + "\"limit\":5,"
             + "\"fields\":[\"id\",\"score\",\"title\"],"
             + 
"\"params\":{\"combiner\":true,\"combiner.query\":[\"lexical1\",\"lexical2\"]}}";
-    QueryResponse rsp = query(CommonParams.JSON, jsonQuery, CommonParams.QT, 
"/search");
+    rsp = query(CommonParams.JSON, multiQuery, CommonParams.QT, "/search");
     assertEquals(5, rsp.getResults().size());
     assertFieldValues(rsp.getResults(), id, "5", "7", "2", "6", "3");
-  }
 
-  /**
-   * Test multiple query execution with sort.
-   *
-   * @throws Exception the exception
-   */
-  @Test
-  public void testMultipleQueryWithSort() throws Exception {
-    prepareIndexDocs();
-    String jsonQuery =
+    // multiple queries with sort
+    String sortQuery =
         "{\"queries\":"
             + "{\"lexical1\":{\"lucene\":{\"query\":\"id:(2^2 OR 3^1 OR 6^2 OR 
5^1)\"}},"
             + "\"lexical2\":{\"lucene\":{\"query\":\"id:(4^1 OR 5^2 OR 7^3 OR 
10^2)\"}}},"
             + "\"limit\":5,\"sort\":\"mod3_idv desc, score desc\""

Review Comment:
   `sortQuery` builds invalid JSON: there is no comma between the `sort` 
property and the following `fields` property, so the request will not parse.



##########
solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java:
##########
@@ -228,38 +207,22 @@ public void testHybridQueryWithPagination() throws 
Exception {
             "/search");
     assertEquals(4, rsp.getResults().size());
     assertFieldValues(rsp.getResults(), id, "6", "3", "10", "4");
-  }
 
-  /**
-   * Tests the single query functionality with faceting only.
-   *
-   * @throws Exception if any unexpected error occurs during the test 
execution.
-   */
-  @Test
-  public void testQueryWithFaceting() throws Exception {
-    prepareIndexDocs();
-    String jsonQuery =
+    // faceting
+    String facetQuery =
         "{\"queries\":"
             + "{\"lexical\":{\"lucene\":{\"query\":\"id:(2^2 OR 3^1 OR 6^2 OR 
5^1)\"}}},"
             + "\"limit\":3,\"offset\":1"

Review Comment:
   `facetQuery` builds invalid JSON: there is no comma between the `offset` 
property and the following `fields` property, so the request will not parse.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to