aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/location.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h4
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp4
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp2
6 files changed, 19 insertions, 13 deletions
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index 01f7e25eb51..7cc11b0dc0c 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -698,7 +698,7 @@ void Test::requireThatQueryGluesEverythingTogether() {
ASSERT_TRUE(search.get());
}
-void checkQueryAddsLocation(Test &test, const string &loc_string) {
+void checkQueryAddsLocation(Test &test, const string &loc_in, const string &loc_out) {
fef_test::IndexEnvironment index_environment;
FieldInfo field_info(FieldType::INDEX, CollectionType::SINGLE, field, 0);
index_environment.getFields().push_back(field_info);
@@ -712,7 +712,7 @@ void checkQueryAddsLocation(Test &test, const string &loc_string) {
Query query;
query.buildTree(stack_dump,
- loc_field + ":" + loc_string,
+ loc_field + ":" + loc_in,
ViewResolver(), index_environment);
vector<const ITermData *> term_data;
query.extractTerms(term_data);
@@ -729,9 +729,9 @@ void checkQueryAddsLocation(Test &test, const string &loc_string) {
query.fetchPostings();
SearchIterator::UP search = query.createSearch(*md);
test.ASSERT_TRUE(search.get());
- if (!test.EXPECT_NOT_EQUAL(string::npos, search->asString().find(loc_string))) {
- fprintf(stderr, "search (missing loc_string '%s'): %s",
- loc_string.c_str(), search->asString().c_str());
+ if (!test.EXPECT_NOT_EQUAL(string::npos, search->asString().find(loc_out))) {
+ fprintf(stderr, "search (missing loc_out '%s'): %s",
+ loc_out.c_str(), search->asString().c_str());
}
}
@@ -790,11 +790,15 @@ void Test::requireThatLocationIsAddedTheCorrectPlace() {
}
void Test::requireThatQueryAddsLocation() {
- checkQueryAddsLocation(*this, "(2,10,10,3,0,1,0,0)");
+ checkQueryAddsLocation(*this, "(2,10,10,3,0,1,0,0)", "{p:{x:10,y:10},r:3,b:{x:[7,13],y:[7,13]}}");
+ checkQueryAddsLocation(*this, "{p:{x:10,y:10},r:3}", "{p:{x:10,y:10},r:3,b:{x:[7,13],y:[7,13]}}");
+ checkQueryAddsLocation(*this, "{b:{x:[6,11],y:[8,15]},p:{x:10,y:10},r:3}", "{p:{x:10,y:10},r:3,b:{x:[7,11],y:[8,13]}}");
+ checkQueryAddsLocation(*this, "{a:12345,b:{x:[8,10],y:[8,10]},p:{x:10,y:10},r:3}", "{p:{x:10,y:10},r:3,a:12345,b:{x:[8,10],y:[8,10]}}");
}
void Test::requireThatQueryAddsLocationCutoff() {
- checkQueryAddsLocation(*this, "[2,10,10,20,20]");
+ checkQueryAddsLocation(*this, "[2,10,11,23,24]", "{b:{x:[10,23],y:[11,24]}}");
+ checkQueryAddsLocation(*this, "{b:{y:[11,24],x:[10,23]}}", "{b:{x:[10,23],y:[11,24]}}");
}
void
diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
index 65959e6e6de..994e26081e7 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
@@ -83,7 +83,7 @@ GeoLocationSpec parse_location_string(string str) {
return empty;
}
GeoLocationParser parser;
- if (parser.parseOldFormatWithField(str)) {
+ if (parser.parseWithField(str)) {
auto attr_name = PositionDataType::getZCurveFieldName(parser.getFieldName());
return GeoLocationSpec{attr_name, parser.getGeoLocation()};
} else {
diff --git a/searchlib/src/vespa/searchlib/query/tree/location.cpp b/searchlib/src/vespa/searchlib/query/tree/location.cpp
index 44f0b82d304..9b45ba18b97 100644
--- a/searchlib/src/vespa/searchlib/query/tree/location.cpp
+++ b/searchlib/src/vespa/searchlib/query/tree/location.cpp
@@ -100,7 +100,7 @@ Location::getJsonFormatString() const
}
vespalib::asciistream &operator<<(vespalib::asciistream &out, const Location &loc) {
- return out << loc.getOldFormatString();
+ return out << loc.getJsonFormatString();
}
} // namespace
diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
index a7e00d41555..66702fcd85c 100644
--- a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
+++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h
@@ -144,7 +144,9 @@ private:
t = &builder.addSuffixTerm(term, view, id, weight);
} else if (type == ParseItem::ITEM_GEO_LOCATION_TERM) {
search::common::GeoLocationParser parser;
- parser.parseOldFormat(term);
+ if (! parser.parseNoField(term)) {
+ LOG(warning, "invalid geo location term '%s'", term.data());
+ }
Location loc(parser.getGeoLocation());
t = &builder.addLocationTerm(loc, view, id, weight);
} else if (type == ParseItem::ITEM_NUMTERM) {
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp
index 1f9b553b56a..822017e0bdf 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumstate.cpp
@@ -76,7 +76,7 @@ GetDocsumsState::parse_locations()
assert(_parsedLocations.empty()); // only allowed to call this once
if (! _args.getLocation().empty()) {
GeoLocationParser parser;
- if (parser.parseOldFormatWithField(_args.getLocation())) {
+ if (parser.parseWithField(_args.getLocation())) {
auto view = parser.getFieldName();
auto attr_name = PositionDataType::getZCurveFieldName(view);
GeoLocationSpec spec{attr_name, parser.getGeoLocation()};
@@ -94,7 +94,7 @@ GetDocsumsState::parse_locations()
vespalib::string view = iterator.getIndexName();
vespalib::string term = iterator.getTerm();
GeoLocationParser parser;
- if (parser.parseOldFormat(term)) {
+ if (parser.parseNoField(term)) {
auto attr_name = PositionDataType::getZCurveFieldName(view);
GeoLocationSpec spec{attr_name, parser.getGeoLocation()};
_parsedLocations.push_back(spec);
diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp
index 06bdb9f69bb..383f6c3d44b 100644
--- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp
@@ -26,7 +26,7 @@ parseLocation(const string & location_str)
return fefLocations;
}
GeoLocationParser locationParser;
- if (!locationParser.parseOldFormatWithField(location_str)) {
+ if (!locationParser.parseWithField(location_str)) {
LOG(warning, "Location parse error (location: '%s'): %s. Location ignored.",
location_str.c_str(), locationParser.getParseError());
return fefLocations;