summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-03-25 09:20:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-03-25 09:20:38 +0000
commitc18ef1f907c6212722027726e389c61f88834409 (patch)
tree34ff3cd20da0ee0a75457164bce26bab8d481743 /searchlib
parent15517f42a72eefd494a232fe5e18f28d1a4544ec (diff)
- Avoid inlining exchange_location_nodes to be able to see its execution cost with.
- Add isIntermediate, and isLocation virtual methods to avoid very expensive dynamic_cast. - Use search::query::LocationTerm, instead of ProtonLocationTerm when possible.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/intermediate.h1
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/node.h5
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/termnodes.h1
3 files changed, 5 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/query/tree/intermediate.h b/searchlib/src/vespa/searchlib/query/tree/intermediate.h
index 2f4323f8e87..2bdc0104927 100644
--- a/searchlib/src/vespa/searchlib/query/tree/intermediate.h
+++ b/searchlib/src/vespa/searchlib/query/tree/intermediate.h
@@ -17,6 +17,7 @@ class Intermediate : public Node
Intermediate() = default;
virtual ~Intermediate() = 0;
+ bool isIntermediate() const override { return true; }
const std::vector<Node *> &getChildren() const { return _children; }
Intermediate &reserve(size_t sz) { _children.reserve(sz); return *this; }
diff --git a/searchlib/src/vespa/searchlib/query/tree/node.h b/searchlib/src/vespa/searchlib/query/tree/node.h
index 4ef0d3b6fc8..2ad6237a1fd 100644
--- a/searchlib/src/vespa/searchlib/query/tree/node.h
+++ b/searchlib/src/vespa/searchlib/query/tree/node.h
@@ -15,9 +15,10 @@ class Node {
public:
typedef std::unique_ptr<Node> UP;
- virtual ~Node() {}
-
+ virtual ~Node() = default;
virtual void accept(QueryVisitor &visitor) = 0;
+ virtual bool isIntermediate() const { return false; }
+ virtual bool isLocationTerm() const { return false; }
};
}
diff --git a/searchlib/src/vespa/searchlib/query/tree/termnodes.h b/searchlib/src/vespa/searchlib/query/tree/termnodes.h
index e112fd6e295..3eda0732470 100644
--- a/searchlib/src/vespa/searchlib/query/tree/termnodes.h
+++ b/searchlib/src/vespa/searchlib/query/tree/termnodes.h
@@ -86,6 +86,7 @@ public:
int32_t id, Weight weight)
: QueryNodeMixinType(term, view, id, weight)
{}
+ bool isLocationTerm() const override { return true; }
virtual ~LocationTerm() = 0;
};