diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-11-19 14:16:03 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-11-19 14:16:03 +0000 |
commit | 9f2c0a443e61d0790b1b87b7126fcfe6c7d6e951 (patch) | |
tree | 703cc2876f8d72badc2734ca314b66b153adbe44 | |
parent | 5361472f495df07e9b1ae2af91c2f780ed8966df (diff) |
Push handling of NearestNeighborTerm down to AttributeBlueprintFactory.
9 files changed, 21 insertions, 21 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp index 2ec3d5b18ee..c8c5a3a427b 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp @@ -109,12 +109,6 @@ private: _result = builder.build(); } - void buildNearestNeighborTerm(ProtonNearestNeighborTerm &n) { - (void) n; - // TODO (geirst): implement - _result = std::make_unique<EmptyBlueprint>(); - } - template <typename NodeType> void buildTerm(NodeType &n) { FieldSpecList indexFields; @@ -149,7 +143,6 @@ protected: void visit(ProtonNear &n) override { buildIntermediate(new NearBlueprint(n.getDistance()), n); } void visit(ProtonONear &n) override { buildIntermediate(new ONearBlueprint(n.getDistance()), n); } void visit(ProtonSameElement &n) override { buildSameElement(n); } - void visit(ProtonNearestNeighborTerm &n) override { buildNearestNeighborTerm(n); } void visit(ProtonWeightedSetTerm &n) override { buildTerm(n); } @@ -166,6 +159,7 @@ protected: void visit(ProtonSuffixTerm &n) override { buildTerm(n); } void visit(ProtonPredicateQuery &n) override { buildTerm(n); } void visit(ProtonRegExpTerm &n) override { buildTerm(n); } + void visit(ProtonNearestNeighborTerm &n) override { buildTerm(n); } public: BlueprintBuilderVisitor(const IRequestContext & requestContext, ISearchContext &context) : diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp index 2a87c4dc953..3184b5cc061 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp @@ -42,7 +42,7 @@ struct TermDataFromTermVisitor void visit(ProtonSuffixTerm &n) override { visitTerm(n); } void visit(ProtonPredicateQuery &) override { } void visit(ProtonRegExpTerm &n) override { visitTerm(n); } - void visit(ProtonNearestNeighborTerm &) override { } + void visit(ProtonNearestNeighborTerm &n) override { visitTerm(n); } }; } // namespace diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp index 3584b0a5744..12128a3df18 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp @@ -202,7 +202,7 @@ private: void visit(SuffixTerm &n) override { visitTerm(n); } void visit(PredicateQuery &n) override { visitTerm(n); } void visit(RegExpTerm &n) override { visitTerm(n); } - void visit(NearestNeighborTerm &) override { } + void visit(NearestNeighborTerm &n) override { visitTerm(n); } public: CreateBlueprintVisitor(const IIndexCollection &indexes, diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 5261f568673..9c132527abc 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -592,6 +592,11 @@ public: createShallowWeightedSet(bp, n, _field, _attr.isIntegerType()); } } + void visit(query::NearestNeighborTerm &n) override { + (void) n; + // TODO (geirst): implement + setResult(std::make_unique<queryeval::EmptyBlueprint>(_field)); + } }; } // namespace diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp index 7d8bcf032ba..ddcee50c219 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp @@ -398,6 +398,8 @@ public: handleNumberTermAsText(n); } + void not_supported(Node &) {} + void visit(LocationTerm &n) override { visitTerm(n); } void visit(PrefixTerm &n) override { visitTerm(n); } void visit(RangeTerm &n) override { visitTerm(n); } @@ -405,7 +407,8 @@ public: void visit(SubstringTerm &n) override { visitTerm(n); } void visit(SuffixTerm &n) override { visitTerm(n); } void visit(RegExpTerm &n) override { visitTerm(n); } - void visit(PredicateQuery &) override { } + void visit(PredicateQuery &n) override { not_supported(n); } + void visit(NearestNeighborTerm &n) override { not_supported(n); } }; Blueprint::UP diff --git a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp index d3d3004100c..d8e48e84fb7 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp @@ -28,6 +28,7 @@ using index::IndexBuilder; using index::Schema; using index::SchemaUtil; using query::LocationTerm; +using query::NearestNeighborTerm; using query::Node; using query::NumberTerm; using query::PredicateQuery; @@ -163,6 +164,8 @@ public: setResult(fieldIndex->make_term_blueprint(termStr, _field, _fieldId)); } + void not_supported(Node &) {} + void visit(LocationTerm &n) override { visitTerm(n); } void visit(PrefixTerm &n) override { visitTerm(n); } void visit(RangeTerm &n) override { visitTerm(n); } @@ -170,7 +173,8 @@ public: void visit(SubstringTerm &n) override { visitTerm(n); } void visit(SuffixTerm &n) override { visitTerm(n); } void visit(RegExpTerm &n) override { visitTerm(n); } - void visit(PredicateQuery &) override { } + void visit(PredicateQuery &n) override { not_supported(n); } + void visit(NearestNeighborTerm &n) override { not_supported(n); } void visit(NumberTerm &n) override { handleNumberTermAsText(n); diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp index 22a1c2166ea..3731b2ff6a8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp @@ -90,12 +90,4 @@ CreateBlueprintVisitorHelper::visitWandTerm(query::WandTerm &n) { n); } -void -CreateBlueprintVisitorHelper::visitNearestNeighborTerm(query::NearestNeighborTerm &n) -{ - (void) n; - // TODO (geirst): implement - setResult(std::make_unique<EmptyBlueprint>()); -} - } diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h index ae1f8938a27..4fd8f64cc99 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h @@ -63,7 +63,6 @@ public: void visit(query::WeightedSetTerm &n) override { visitWeightedSetTerm(n); } void visit(query::DotProduct &n) override { visitDotProduct(n); } void visit(query::WandTerm &n) override { visitWandTerm(n); } - void visit(query::NearestNeighborTerm &n) override { visitNearestNeighborTerm(n); } void visit(query::NumberTerm &n) override = 0; void visit(query::LocationTerm &n) override = 0; @@ -73,6 +72,7 @@ public: void visit(query::SubstringTerm &n) override = 0; void visit(query::SuffixTerm &n) override = 0; void visit(query::RegExpTerm &n) override = 0; + void visit(query::NearestNeighborTerm &n) override = 0; }; } diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp index 4c678a9902f..fc3a6399e00 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp @@ -6,9 +6,10 @@ #include "create_blueprint_visitor_helper.h" #include <vespa/vespalib/objects/visit.h> -using search::query::NumberTerm; using search::query::LocationTerm; +using search::query::NearestNeighborTerm; using search::query::Node; +using search::query::NumberTerm; using search::query::PredicateQuery; using search::query::PrefixTerm; using search::query::RangeTerm; @@ -64,6 +65,7 @@ public: void visit(SuffixTerm &n) override { visitTerm(n); } void visit(PredicateQuery &n) override { visitTerm(n); } void visit(RegExpTerm &n) override { visitTerm(n); } + void visit(NearestNeighborTerm &n) override { visitTerm(n); } }; template <class Map> |