diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-05-10 14:04:45 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-05-10 14:04:45 +0000 |
commit | 0c906e5b1dea72c9a6735aefccdc3d13ac558335 (patch) | |
tree | 48a3163739ac506a49031997e12dd24efb16e59a /searchlib/src/tests/queryeval | |
parent | 568fec4d32c409a92737af54d5e101deb730750a (diff) |
Auto-adjust targetHits for approximate nearest neighbor search when using post-filtering.
The goal is to expose 'targetHits' hits to first-phase ranking.
Before searching the HNSW index, targetHits is adjusted based on the estimated hit ratio of the query
to compensate for the hits that will be removed in post-filtering.
Diffstat (limited to 'searchlib/src/tests/queryeval')
-rw-r--r-- | searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp | 8 | ||||
-rw-r--r-- | searchlib/src/tests/queryeval/blueprint/mysearch.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp index dbfe51926c9..45183696dfc 100644 --- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp @@ -72,7 +72,7 @@ TEST("test AndNot Blueprint") { EXPECT_EQUAL(true, a.getState().want_global_filter()); auto empty_global_filter = GlobalFilter::create(); EXPECT_FALSE(empty_global_filter->has_filter()); - a.set_global_filter(*empty_global_filter); + a.set_global_filter(*empty_global_filter, 1.0); EXPECT_EQUAL(false, got_global_filter(a.getChild(0))); EXPECT_EQUAL(true, got_global_filter(a.getChild(1))); } @@ -147,7 +147,7 @@ TEST("test And Blueprint") { a.addChild(ap(MyLeafSpec(20).addField(1, 1).want_global_filter().create())); EXPECT_EQUAL(true, a.getState().want_global_filter()); auto empty_global_filter = GlobalFilter::create(); - a.set_global_filter(*empty_global_filter); + a.set_global_filter(*empty_global_filter, 1.0); EXPECT_EQUAL(false, got_global_filter(a.getChild(0))); EXPECT_EQUAL(true, got_global_filter(a.getChild(1))); } @@ -227,7 +227,7 @@ TEST("test Or Blueprint") { o.addChild(ap(MyLeafSpec(20).addField(1, 1).want_global_filter().create())); EXPECT_EQUAL(true, o.getState().want_global_filter()); auto empty_global_filter = GlobalFilter::create(); - o.set_global_filter(*empty_global_filter); + o.set_global_filter(*empty_global_filter, 1.0); EXPECT_EQUAL(false, got_global_filter(o.getChild(0))); EXPECT_EQUAL(true, got_global_filter(o.getChild(o.childCnt() - 1))); } @@ -382,7 +382,7 @@ TEST("test Rank Blueprint") { a.addChild(ap(MyLeafSpec(20).addField(1, 1).want_global_filter().create())); EXPECT_EQUAL(true, a.getState().want_global_filter()); auto empty_global_filter = GlobalFilter::create(); - a.set_global_filter(*empty_global_filter); + a.set_global_filter(*empty_global_filter, 1.0); EXPECT_EQUAL(false, got_global_filter(a.getChild(0))); EXPECT_EQUAL(true, got_global_filter(a.getChild(1))); } diff --git a/searchlib/src/tests/queryeval/blueprint/mysearch.h b/searchlib/src/tests/queryeval/blueprint/mysearch.h index 38027b756be..346a1fb12be 100644 --- a/searchlib/src/tests/queryeval/blueprint/mysearch.h +++ b/searchlib/src/tests/queryeval/blueprint/mysearch.h @@ -126,7 +126,7 @@ public: set_cost_tier(value); return *this; } - void set_global_filter(const GlobalFilter &) override { + void set_global_filter(const GlobalFilter &, double) override { _got_global_filter = true; } bool got_global_filter() const { return _got_global_filter; } |