summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-03-26 12:39:10 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-03-26 12:39:10 +0000
commita77d301703076d9f3ca81053d2ed017ec50fde23 (patch)
tree4fa1e37f028d1c5d4d650b53037698db8131b66b /searchlib
parentf0c9bbe78ecbee2efa67a9843f39a514d5e2e901 (diff)
Remove template parameter not needed and reduce inlining.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp52
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp3
2 files changed, 31 insertions, 24 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index 5ba38d803c8..0c4c5271763 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -620,17 +620,11 @@ public:
void visit(PredicateQuery &n) override { visitPredicate(n); }
void visit(RegExpTerm & n) override { visitTerm(n); }
- template <typename WS, typename NODE>
- void createDirectWeightedSet(WS *bp, NODE &n) {
- Blueprint::UP result(bp);
- for (size_t i = 0; i < n.getChildren().size(); ++i) {
- const query::Node &node = *n.getChildren()[i];
- vespalib::string term = queryeval::termAsString(node);
- uint32_t weight = queryeval::getWeightFromNode(node).percent();
- bp->addTerm(term, weight);
- }
- setResult(std::move(result));
- }
+ template <typename WS>
+ void createDirectWeightedSet(WS *bp, search::query::Intermediate &n);
+
+ template <typename WS>
+ void createShallowWeightedSet(WS *bp, search::query::Intermediate &n, const FieldSpec &fs, bool isInteger);
static QueryTermSimple::UP
extractTerm(const query::Node &node, bool isInteger) {
@@ -641,18 +635,6 @@ public:
return std::make_unique<QueryTermUCS4>(term, QueryTermSimple::Type::WORD);
}
- template <typename WS, typename NODE>
- void createShallowWeightedSet(WS *bp, NODE &n, const FieldSpec &fs, bool isInteger) {
- Blueprint::UP result(bp);
- for (size_t i = 0; i < n.getChildren().size(); ++i) {
- const query::Node &node = *n.getChildren()[i];
- uint32_t weight = queryeval::getWeightFromNode(node).percent();
- FieldSpec childfs = bp->getNextChildField(fs);
- bp->addTerm(std::make_unique<AttributeFieldBlueprint>(childfs, _attr, extractTerm(node, isInteger)), weight);
- }
- setResult(std::move(result));
- }
-
void visit(query::WeightedSetTerm &n) override {
bool isSingleValue = !_attr.hasMultiValue();
bool isString = (_attr.isStringType() && _attr.hasEnum());
@@ -741,6 +723,30 @@ public:
}
};
+template <typename WS>
+void
+CreateBlueprintVisitor::createDirectWeightedSet(WS *bp, search::query::Intermediate &n) {
+ Blueprint::UP result(bp);
+ for (const Node * node : n.getChildren()) {
+ vespalib::string term = queryeval::termAsString(*node);
+ uint32_t weight = queryeval::getWeightFromNode(*node).percent();
+ bp->addTerm(term, weight);
+ }
+ setResult(std::move(result));
+}
+
+template <typename WS>
+void
+CreateBlueprintVisitor::createShallowWeightedSet(WS *bp, search::query::Intermediate &n, const FieldSpec &fs, bool isInteger) {
+ Blueprint::UP result(bp);
+ for (const Node * node : n.getChildren()) {
+ uint32_t weight = queryeval::getWeightFromNode(*node).percent();
+ FieldSpec childfs = bp->getNextChildField(fs);
+ bp->addTerm(std::make_unique<AttributeFieldBlueprint>(childfs, _attr, extractTerm(*node, isInteger)), weight);
+ }
+ setResult(std::move(result));
+}
+
} // namespace
//-----------------------------------------------------------------------------
diff --git a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
index bd9de0a1762..344cf90da12 100644
--- a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp
@@ -18,7 +18,8 @@ struct WeightExtractor : public TemplateTermVisitor<WeightExtractor, SimpleQuery
WeightExtractor() : weight(0) {}
- template <class TermType> void visitTerm(TermType &n) {
+ template <class TermType>
+ void visitTerm(TermType &n) {
weight = n.getWeight();
}