Skip to content

Commit

Permalink
Always use the search pattern when searching in the server.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mgautierfr committed Mar 28, 2022
1 parent 38753dc commit 3aca36f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/server/internalServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,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 (has_geo_query) {
if (verbose) {
cout << "Performing geo query `" << geo_query.distance << "&(" << geo_query.latitude << ";" << geo_query.longitude << ")'" << endl;
std::cout << " with geo query '" << geo_query.distance << "&(" << geo_query.latitude << ";" << geo_query.longitude << ")'";
}
query.setQuery("");
query.setGeorange(geo_query.latitude, geo_query.longitude, geo_query.distance);
} else {
// Execute Ft search
if (verbose) {
cout << "Performing query `" << pattern << "'" << endl;
}
query.setQuery(pattern);
}
if (verbose) {
std::cout << std::endl;
}
return query;
}
Expand Down

0 comments on commit 3aca36f

Please sign in to comment.