From 443088f6093d3420212be0e1af3b9e802dca9362 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 6 Aug 2024 22:03:31 +0300 Subject: Add support for advanced package search --- mod/mod-repository-root.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'mod/mod-repository-root.cxx') diff --git a/mod/mod-repository-root.cxx b/mod/mod-repository-root.cxx index bc861a8..165302d 100644 --- a/mod/mod-repository-root.cxx +++ b/mod/mod-repository-root.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,7 @@ namespace brep // tenant_service_map_ (make_shared ()), packages_ (make_shared ()), + advanced_search_ (make_shared ()), package_details_ (make_shared ()), package_version_details_ (make_shared ()), repository_details_ (make_shared ()), @@ -153,6 +155,10 @@ namespace brep r.initialized_ ? r.packages_ : make_shared (*r.packages_)), + advanced_search_ ( + r.initialized_ + ? r.advanced_search_ + : make_shared (*r.advanced_search_)), package_details_ ( r.initialized_ ? r.package_details_ @@ -225,6 +231,7 @@ namespace brep { option_descriptions r (handler::options ()); append (r, packages_->options ()); + append (r, advanced_search_->options ()); append (r, package_details_->options ()); append (r, package_version_details_->options ()); append (r, repository_details_->options ()); @@ -272,6 +279,7 @@ namespace brep // Initialize sub-handlers. // sub_init (*packages_, "packages"); + sub_init (*advanced_search_, "advanced_search"); sub_init (*package_details_, "package_details"); sub_init (*package_version_details_, "package_version_details"); sub_init (*repository_details_, "repository_details"); @@ -305,7 +313,13 @@ namespace brep auto verify = [&fail] (const string& v, const char* what) { cstrings vs ({ - "packages", "builds", "build-configs", "about", "submit", "ci"}); + "packages", + "advanced-search", + "builds", + "build-configs", + "about", + "submit", + "ci"}); if (find (vs.begin (), vs.end (), v) == vs.end ()) fail << what << " value '" << v << "' is invalid"; @@ -459,6 +473,13 @@ namespace brep return handle ("packages", param); } + else if (func == "advanced-search") + { + if (handler_ == nullptr) + handler_.reset (new advanced_search (*advanced_search_)); + + return handle ("advanced_search", param); + } else if (func == "about") { if (handler_ == nullptr) -- cgit v1.1