fabriziofortino commented on code in PR #3079:
URL: https://github.com/apache/jackrabbit-oak/pull/3079#discussion_r3863620853


##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticDynamicBoostTest.java:
##########
@@ -85,6 +87,63 @@ public void dynamicBoostAnalyzed() throws Exception {
         });
     }
 
+    @After
+    public void resetDynamicBoostGroupingToggle() {
+        ElasticDocument.FT_OAK_12353_ENABLE.set(true);
+    }
+
+    /**
+     * Predicted tags sharing the same boost score are grouped into a single 
nested document
+     * (see {@link ElasticDocument#FT_OAK_12353_ENABLE}). This verifies that 
querying still
+     * matches on any of the grouped values, both with the grouping enabled 
(default) and
+     * disabled.
+     */
+    @Test
+    public void dynamicBoostQueriesGroupedValuesSharingSameBoostScore() throws 
Exception {
+        createAssetsIndexAndProperties(false, false);
+
+        Tree testParent = createNodeWithType(root.getTree("/"), "test", 
JcrConstants.NT_UNSTRUCTURED, "");
+
+        Tree predicted1 = createAssetNodeWithPredicted(testParent, "asset1", 
"flower with a lot of red and a bit of blue");
+        createPredictedTag(predicted1, "red", 5.0);
+        createPredictedTag(predicted1, "blue", 5.0);
+        createPredictedTag(predicted1, "green", 5.0);
+        createPredictedTag(predicted1, "special", 9.0);
+
+        root.commit();
+
+        assertEventually(() -> {
+            assertQuery("//element(*, dam:Asset)[jcr:contains(., 'red')]", 
XPATH, List.of("/test/asset1"));
+            assertQuery("//element(*, dam:Asset)[jcr:contains(., 'blue')]", 
XPATH, List.of("/test/asset1"));
+            assertQuery("//element(*, dam:Asset)[jcr:contains(., 'green')]", 
XPATH, List.of("/test/asset1"));
+            assertQuery("//element(*, dam:Asset)[jcr:contains(., 'special')]", 
XPATH, List.of("/test/asset1"));
+        });
+    }
+

Review Comment:
   good point. This was actually caused by the (not strictly necessary) 
optimization to disable norms. I have removed it. I also included this test and 
re-structure the test class that now runs parametrically (JUnit4 Parameterized) 
over FT_OAK_12353_ENABLE = true/false.



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

Reply via email to