aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-04 15:55:50 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-04 15:55:50 +0200
commit744cbe633ad293b4894d524b2f1505af5dfc2d41 (patch)
tree846a51ba4d78a21d16ba735b3c38093061ecb7d9
parent3397e58aae2dad0abbec4e1d2d8c87c220e52a8e (diff)
Introduce a common parent of the various term nodes.
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.h2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.h8
2 files changed, 7 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.h b/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.h
index 6109f5096c3..04b2055ef76 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/sameelementmodifier.h
@@ -22,7 +22,7 @@ public:
vespalib::string prefix = n.getView() + ".";
for (auto & child : n.getChildren()) {
- search::query::StringBase * term = dynamic_cast<search::query::StringBase *>(child);
+ search::query::TermNode * term = dynamic_cast<search::query::TermNode *>(child);
const vespalib::string & index = term->getView();
if (index.find(prefix) != 0) { // This can be removed when qrs does not prefix the sameelemnt children
term->setView(prefix + index);
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h
index b544109317b..f931a54eda9 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.h
+++ b/searchlib/src/vespa/searchlib/query/tree/term.h
@@ -41,11 +41,15 @@ protected:
Term(const vespalib::stringref &view, int32_t id, Weight weight);
};
+class TermNode : public Node, public Term {
+protected:
+ TermNode(vespalib::stringref view, int32_t id, Weight weight) : Term(view, id, weight) {}
+};
/**
* Generic functionality for most of Term's derived classes.
*/
template <typename T>
-class TermBase : public Node, public Term {
+class TermBase : public TermNode {
T _term;
public:
@@ -61,7 +65,7 @@ protected:
template <typename T>
TermBase<T>::TermBase(T term, vespalib::stringref view, int32_t id, Weight weight)
- : Term(view, id, weight),
+ : TermNode(view, id, weight),
_term(std::move(term))
{}