Skip to content

Commit

Permalink
Migrated REST API of the Replication system
Browse files Browse the repository at this point in the history
The new implementation of the Qserv query search service no longer
uses the full-text indexes on the query text. The service now relies
on the simpler search methods LIKE and REGEXP.

The version number of the API is now 23.
  • Loading branch information
iagaponenko committed Aug 1, 2023
1 parent c661f0f commit f8e1c8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/admin/python/lsst/qserv/admin/replicationInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
self.repl_ctrl = urlparse(repl_ctrl_uri)
self.auth_key = auth_key
self.admin_auth_key = admin_auth_key
self.repl_api_version = 22
self.repl_api_version = 23
_log.debug(f"ReplicationInterface %s", self.repl_ctrl)

def version(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/replica/HttpMetaModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using json = nlohmann::json;

namespace lsst::qserv::replica {

unsigned int const HttpMetaModule::version = 22;
unsigned int const HttpMetaModule::version = 23;

void HttpMetaModule::process(ServiceProvider::Ptr const& serviceProvider, string const& context,
qhttp::Request::Ptr const& req, qhttp::Response::Ptr const& resp,
Expand Down
13 changes: 8 additions & 5 deletions src/replica/HttpQservMonitorModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ json HttpQservMonitorModule::_schedulers2chunks2json(map<string, set<int>> const

json HttpQservMonitorModule::_userQueries() {
debug(__func__);
checkApiVersion(__func__, 12);
checkApiVersion(__func__, 23);

auto const config = controller()->serviceProvider()->config();

Expand All @@ -292,7 +292,7 @@ json HttpQservMonitorModule::_userQueries() {
unsigned int const timeoutSec = query().optionalUInt("timeout_sec", workerResponseTimeoutSec());
unsigned int const limit4past = query().optionalUInt("limit4past", 1);
string const searchPattern = query().optionalString("search_pattern", string());
bool const searchBooleanMode = query().optionalUInt("search_boolean_mode", 0) != 0;
bool const searchRegexpMode = query().optionalUInt("search_regexp_mode", 0) != 0;
bool const includeMessages = query().optionalUInt("include_messages", 0) != 0;

debug(__func__, "query_status=" + queryStatus);
Expand All @@ -302,7 +302,7 @@ json HttpQservMonitorModule::_userQueries() {
debug(__func__, "timeout_sec=" + to_string(timeoutSec));
debug(__func__, "limit4past=" + to_string(limit4past));
debug(__func__, "search_pattern=" + searchPattern);
debug(__func__, "search_boolean_mode=" + bool2str(searchBooleanMode));
debug(__func__, "search_regexp_mode=" + bool2str(searchRegexpMode));
debug(__func__, "include_messages=" + bool2str(includeMessages));

// Check which queries and in which schedulers are being executed
Expand Down Expand Up @@ -360,8 +360,11 @@ json HttpQservMonitorModule::_userQueries() {
g.packCond(constraints, cond);
}
if (!searchPattern.empty()) {
string const mode = searchBooleanMode ? "BOOLEAN" : "NATURAL LANGUAGE";
g.packCond(constraints, g.matchAgainst("query", searchPattern, mode));
if (searchRegexpMode) {
g.packCond(constraints, g.regexp("query", searchPattern));
} else {
g.packCond(constraints, g.like("query", "%" + searchPattern + "%"));
}
}
h.conn->executeInOwnTransaction([&](auto conn) {
result["queries_past"] = _pastUserQueries(conn, constraints, limit4past, includeMessages);
Expand Down

0 comments on commit f8e1c8c

Please sign in to comment.