Always use the search pattern when searching in the server.

There is no reason to not use the pattern if there is a geo_query.
If both the pattern and the qeo_query are provided, we must use both.
This commit is contained in:
Matthieu Gautier 2022-03-17 15:48:59 +01:00
parent f2a1c0f106
commit 311f783ea9
1 changed files with 9 additions and 10 deletions

View File

@ -140,19 +140,18 @@ SearchInfo::SearchInfo(const RequestContext& request)
zim::Query SearchInfo::getZimQuery(bool verbose) const {
zim::Query query;
if(pattern.empty()) {
// Execute geo-search
if (verbose) {
std::cout << "Performing query '" << pattern<< "'";
}
query.setQuery(pattern);
if (geoQuery) {
if (verbose) {
cout << "Performing geo query `" << geoQuery.distance << "&(" << geoQuery.latitude << ";" << geQuery.longitude << ")'" << endl;
std::cout << " with geo query '" << geoQuery.distance << "&(" << geoQuery.latitude << ";" << geoQuery.longitude << ")'";
}
query.setQuery("");
query.setGeorange(geoQuery.latitude, geoQuery.longitude, geoQuery.distance);
} else {
// Execute Ft search
if (verbose) {
cout << "Performing query `" << pattern << "'" << endl;
}
query.setQuery(pattern);
}
if (verbose) {
std::cout << std::endl;
}
return query;
}