diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-01-12 14:40:39 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2023-01-12 14:40:39 +0000 |
commit | ca18a63e3b492b218026ca012970d4bb7cecc992 (patch) | |
tree | 169dd9600b7501d3dfd58c73c2e54c1de99d6a42 /searchlib/src/tests/features | |
parent | 6520197c31113ba7cb173138f2431d3a481ab494 (diff) |
Expose SameElement query terms to ranking.
A TermFieldMatchData is allocated per SameElement term,
and this is used to signal matching docids in doUnpack() on the SameElement search iterator.
This allows using the matches() rank feature on a field (virtual) that is searched using a SameElement term.
Diffstat (limited to 'searchlib/src/tests/features')
-rw-r--r-- | searchlib/src/tests/features/prod_features.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp index 03563196379..81c46558381 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features.cpp @@ -1717,6 +1717,17 @@ Test::testMatches() EXPECT_TRUE(ft.execute(RankResult().addScore("matches(foo,2)", 0))); EXPECT_TRUE(ft.execute(RankResult().addScore("matches(foo,3)", 0))); } + { // Test executor for virtual fields + FtFeatureTest ft(_factory, StringList().add("matches(foo)")); + ft.getIndexEnv().getBuilder().addField(FieldType::VIRTUAL, CollectionType::ARRAY, "foo"); + ASSERT_TRUE(ft.getQueryEnv().getBuilder().add_virtual_node("foo") != nullptr); // query term 0 hits in foo + ASSERT_TRUE(ft.setup()); + + auto mdb = ft.createMatchDataBuilder(); + mdb->setWeight("foo", 0, 100); + mdb->apply(1); + EXPECT_TRUE(ft.execute(RankResult().addScore("matches(foo)", 1))); + } } bool |