diff options
author | Alexey Chernyshev <aleksei@spotify.com> | 2022-03-10 16:33:07 +0100 |
---|---|---|
committer | Alexey Chernyshev <aleksei@spotify.com> | 2022-03-23 16:20:59 +0100 |
commit | d9805209e3b0e33be3c0cc454c4604043663c1c4 (patch) | |
tree | 7446c79f68acd8775233ace4d5a70058f90c8406 /searchcore | |
parent | a2b1e6654cabc90ddf7422e58adf641876e5201c (diff) |
Introducing fuzzy search
Diffstat (limited to 'searchcore')
7 files changed, 9 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index a09437be46b..fd3dd0da518 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -278,6 +278,7 @@ public: void visit(ProtonSubstringTerm &n) override { checkNode(n, 0, true); } void visit(ProtonSuffixTerm &n) override { checkNode(n, 2, false); } void visit(ProtonPhrase &n) override { checkNode(n, 0, true); } + void visit(ProtonFuzzyTerm &n) override { checkNode(n, 1, false); } void visit(ProtonWeightedSetTerm &) override {} void visit(ProtonDotProduct &) override {} void visit(ProtonWandTerm &) override {} @@ -435,6 +436,7 @@ public: void visit(ProtonPredicateQuery &) override {} void visit(ProtonRegExpTerm &) override {} void visit(ProtonNearestNeighborTerm &) override {} + void visit(ProtonFuzzyTerm &) override {} }; void Test::requireThatTermDataIsFilledIn() { diff --git a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp index ffd08b3bbef..78486f54704 100644 --- a/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp +++ b/searchcore/src/tests/proton/matching/unpacking_iterators_optimizer/unpacking_iterators_optimizer_test.cpp @@ -69,6 +69,7 @@ struct DumpQuery : QueryVisitor { void visit(NearestNeighborTerm &) override {} void visit(TrueQueryNode &) override {} void visit(FalseQueryNode &) override {} + void visit(FuzzyTerm &) override {} }; std::string dump_query(Node &root) { diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp index 9be5920c0ed..92d7e385293 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp @@ -165,6 +165,7 @@ protected: void visit(ProtonFalse &) override { _result = std::make_unique<EmptyBlueprint>(); } + void visit(ProtonFuzzyTerm &n) override { buildTerm(n); } public: BlueprintBuilderVisitor(const IRequestContext & requestContext, ISearchContext &context) : diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h index e7817dcecd2..d8060832d5d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h +++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h @@ -137,6 +137,7 @@ typedef ProtonTerm<search::query::WandTerm> ProtonWandTerm; typedef ProtonTerm<search::query::PredicateQuery> ProtonPredicateQuery; typedef ProtonTerm<search::query::RegExpTerm> ProtonRegExpTerm; typedef ProtonTerm<search::query::NearestNeighborTerm> ProtonNearestNeighborTerm; +typedef ProtonTerm<search::query::FuzzyTerm> ProtonFuzzyTerm; struct ProtonNodeTypes { typedef ProtonAnd And; @@ -164,6 +165,7 @@ struct ProtonNodeTypes { typedef ProtonNearestNeighborTerm NearestNeighborTerm; typedef ProtonTrue TrueQueryNode; typedef ProtonFalse FalseQueryNode; + typedef ProtonFuzzyTerm FuzzyTerm; }; } diff --git a/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp b/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp index 34cb5369c1e..574df384a63 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/same_element_builder.cpp @@ -69,6 +69,7 @@ public: void visit(ProtonNearestNeighborTerm &) override {} void visit(ProtonTrue &) override {} void visit(ProtonFalse &) override {} + void visit(ProtonFuzzyTerm &n) override { visitTerm(n); } }; } // namespace proton::matching::<unnamed> diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp index c2abeaa36ee..a32107836ca 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp @@ -45,6 +45,7 @@ struct TermDataFromTermVisitor void visit(ProtonPredicateQuery &) override { } void visit(ProtonRegExpTerm &n) override { visitTerm(n); } void visit(ProtonNearestNeighborTerm &n) override { visitTerm(n); } + void visit(ProtonFuzzyTerm &n) override { visitTerm(n); } }; } // namespace diff --git a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp index 72a53a1a3d2..72e0153b5c2 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/unpacking_iterators_optimizer.cpp @@ -59,6 +59,7 @@ struct TermExpander : QueryVisitor { void visit(NearestNeighborTerm &) override {} void visit(TrueQueryNode &) override {} void visit(FalseQueryNode &) override {} + void visit(FuzzyTerm &) override {} void flush(Intermediate &parent) { for (Node::UP &term: terms) { |