nfsantos commented on code in PR #1949:
URL: https://github.com/apache/jackrabbit-oak/pull/1949#discussion_r1907099821
##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticDynamicBoostTest.java:
##########
@@ -84,4 +84,39 @@ public void dynamicBoostAnalyzed() throws Exception {
List.of("/test/asset2", "/test/asset1"));
});
}
+
+ @Test
+ public void dynamicBoostNotIncludedInFullText() throws Exception {
+ createAssetsIndexAndProperties(false, 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, "fooTag", 100.0);
+ createPredictedTag(predicted1, "barTag", 1.0);
+ createPredictedTag(predicted1, "red", 9.0);
+ createPredictedTag(predicted1, "blue", 1.0);
+
+ Tree predicted2 = createAssetNodeWithPredicted(testParent, "asset2",
"flower with a lot of blue and a bit of red");
+ createPredictedTag(predicted1, "fooTag", 1.0);
+ createPredictedTag(predicted1, "barTag", 100.0);
+ createPredictedTag(predicted2, "red", 1.0);
+ createPredictedTag(predicted2, "blue", 9.0);
+
+ Tree predicted3 = createAssetNodeWithPredicted(testParent, "asset3",
"this is a not matching asset");
+ createPredictedTag(predicted3, "fooTag", 1.0);
+ createPredictedTag(predicted3, "barTag", 1.0);
+
+ root.commit();
+
+ assertEventually(() -> {
+ // with this test we are checking that the dynamic boost is not
included in the fulltext search
+ assertQuery("//element(*, dam:Asset)[jcr:contains(., 'fooTag')]",
XPATH, List.of());
+ assertOrderedQuery("select [jcr:path] from [dam:Asset] where
contains(title, 'flower OR fooTag')",
+ List.of("/test/asset1", "/test/asset2"));
+ assertOrderedQuery("select [jcr:path] from [dam:Asset] where
contains(title, 'flower OR barTag')",
+ List.of("/test/asset1", "/test/asset2"));
Review Comment:
I don't fully understand how dynamic boost works, so this is likely just my
ignorance. But why do these two queries return exactly the same results? I
would expect that since `asset1` and `asset2` have different coefficients for
their properties, this would somehow be visible on the test results. If we
would set the coefficients to the same values in the two assets, would the
results of these queries change?
--
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]