diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-28 22:07:37 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-29 13:56:56 +0000 |
commit | d4712740d1281fa3a2fa945dfd3ea4c2182d663c (patch) | |
tree | 1ace22ed894ed094bbb5c1725899124e325781f0 /juniper/src | |
parent | fef814ec263ce1ceca0416251b3204f43ee3ed30 (diff) |
- Let DotProduct,Wand and WeightedSet be Term nodes in the query tree as they really are.
That restricts the nodes to what they can really do and makes them significantly cheaper.
- In addition type conversion of numeric terms is delayed to when it is necessary.
And as next step they can be avoided completely.
Diffstat (limited to 'juniper/src')
-rw-r--r-- | juniper/src/vespa/juniper/query.h | 11 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/queryvisitor.cpp | 12 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/queryvisitor.h | 7 |
3 files changed, 3 insertions, 27 deletions
diff --git a/juniper/src/vespa/juniper/query.h b/juniper/src/vespa/juniper/query.h index 63a6a9e1a4a..2d8c6b4bbe0 100644 --- a/juniper/src/vespa/juniper/query.h +++ b/juniper/src/vespa/juniper/query.h @@ -155,17 +155,6 @@ public: */ virtual bool VisitANDNOT(const QueryItem* item, int arity) = 0; - /** To be called upon by IQuery::Traverse visiting a THRESHOLD query item - * @param item The (opaque to IQueryVisitor) item that is visited - * @param arity The number of children of this item - * @param threshold The threshold value for which the sum of the individual - * subexpressions' weights (as obtained by the IQueryVisitor::Weight function - * should result in a hit for the THRESHOLD expression. - * @return if false, caller should skip calling this element's children visitors, - * otherwise caller should proceed as normal - */ - virtual bool VisitTHRESHOLD(const QueryItem* item, int arity, int threshold) = 0; - /** To be called upon by IQuery::Traverse visiting any other query item * than the ones handled by Juniper (to avoid inconsistency in the * traversal wrt. arities) diff --git a/juniper/src/vespa/juniper/queryvisitor.cpp b/juniper/src/vespa/juniper/queryvisitor.cpp index f8f8d2d3da7..96a3f4ce771 100644 --- a/juniper/src/vespa/juniper/queryvisitor.cpp +++ b/juniper/src/vespa/juniper/queryvisitor.cpp @@ -189,21 +189,11 @@ bool QueryVisitor::VisitANDNOT(const QueryItem*, int arity) return true; } -bool QueryVisitor::VisitTHRESHOLD(const QueryItem*, int arity, int threshold) -{ - LOG(debug, "juniper: VisitTHRESHOLD[%d,%d]", arity, threshold); - QueryNode* node = new QueryNode(arity, threshold); - node->_options = _qhandle->_options; - - insert(node); - return true; -} - bool QueryVisitor::VisitOther(const QueryItem*, int arity) { LOG(debug, "juniper: VisitOther[%d]", arity); - insert(NULL); + insert(nullptr); return false; } diff --git a/juniper/src/vespa/juniper/queryvisitor.h b/juniper/src/vespa/juniper/queryvisitor.h index 2557e91021c..abdd3d2b28c 100644 --- a/juniper/src/vespa/juniper/queryvisitor.h +++ b/juniper/src/vespa/juniper/queryvisitor.h @@ -22,6 +22,8 @@ namespace juniper { class QueryVisitor : public juniper::IQueryVisitor { public: + QueryVisitor(QueryVisitor &) = delete; + QueryVisitor &operator=(QueryVisitor &) = delete; QueryVisitor(const IQuery& query, QueryHandle* qhandle, juniper::QueryModifier & queryModifier); ~QueryVisitor(); @@ -33,7 +35,6 @@ public: bool VisitRANK(const QueryItem* item, int arity) override; bool VisitPHRASE(const QueryItem* item, int arity) override; bool VisitANDNOT(const QueryItem* item, int arity) override; - bool VisitTHRESHOLD(const QueryItem* item, int arity, int threshold) override; bool VisitOther(const QueryItem* item, int arity) override; void VisitKeyword(const QueryItem* item, const char* keyword, const size_t length = 0, bool prefix = false, bool specialToken = false) override; @@ -49,7 +50,6 @@ protected: std::string get_index(const QueryItem* item); private: // Helper functions/members for use during construction only. - void update_parameters(const char* options); void insert(QueryExpr* expr); void postprocess_query(); juniper::QueryModifier & _queryModifier; @@ -62,9 +62,6 @@ private: QueryHandle* _qhandle; int _term_index; bool _got_stack; // Set when we have created a stack root - - QueryVisitor(QueryVisitor &); - QueryVisitor &operator=(QueryVisitor &); }; |