aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-13 10:58:30 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-07-13 13:20:22 +0000
commitb75d5f4f9e7a4418b956548cdbe850849ee76470 (patch)
tree641787902a55d042b3df84b6619811ff31fab8f3
parent12a961c14bf256cd07d75e3dd1adf408b972e07b (diff)
If a range is represented as a StringTerm we can not handle it with a DWA.
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/term.h3
3 files changed, 6 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
index b6e406e2d24..399c0266ec9 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp
@@ -66,6 +66,7 @@ using search::query::StackDumpCreator;
using search::query::StringTerm;
using search::query::SubstringTerm;
using search::query::SuffixTerm;
+using search::query::Term;
using search::queryeval::AndBlueprint;
using search::queryeval::AndSearchStrict;
using search::queryeval::Blueprint;
@@ -700,7 +701,7 @@ public:
template <class TermNode>
void visitSimpleTerm(TermNode &n) {
- if ((_dwa != nullptr) && !_field.isFilter() && n.isRanked()) {
+ if ((_dwa != nullptr) && !_field.isFilter() && n.isRanked() && !Term::isPossibleRangeTerm(n.getTerm())) {
NodeAsKey key(n, _scratchPad);
setResult(std::make_unique<DirectAttributeBlueprint>(_field, _attr, *_dwa, key));
} else {
diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
index 8b08ae9daa5..160fe747db0 100644
--- a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
+++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
@@ -174,7 +174,7 @@ private:
Location loc(parser.getGeoLocation());
t = &builder.addLocationTerm(loc, view, id, weight);
} else if (type == ParseItem::ITEM_NUMTERM) {
- if (term[0] == '[' || term[0] == '<' || term[0] == '>') {
+ if (Term::isPossibleRangeTerm(term)) {
Range range(term);
t = &builder.addRangeTerm(range, view, id, weight);
} else {
diff --git a/searchlib/src/vespa/searchlib/query/tree/term.h b/searchlib/src/vespa/searchlib/query/tree/term.h
index b8ce4fe035d..749d0f5a588 100644
--- a/searchlib/src/vespa/searchlib/query/tree/term.h
+++ b/searchlib/src/vespa/searchlib/query/tree/term.h
@@ -34,6 +34,9 @@ public:
bool isRanked() const { return _ranked; }
bool usePositionData() const { return _position_data; }
+ static bool isPossibleRangeTerm(vespalib::stringref term) noexcept {
+ return (term[0] == '[' || term[0] == '<' || term[0] == '>');
+ }
protected:
Term(vespalib::stringref view, int32_t id, Weight weight);
};