fabriziofortino commented on code in PR #1949: URL: https://github.com/apache/jackrabbit-oak/pull/1949#discussion_r1907151310
########## 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: Thanks for spotting this! The test setup and assertion were wrong. Fixed now. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org