From aaaeb4429ffa9984e1c37b43bf9aad1455b8b735 Mon Sep 17 00:00:00 2001 From: amass Date: Tue, 7 Jan 2025 17:18:20 +0800 Subject: [PATCH] add reindex hint. --- Server/Application.cpp | 16 +++++++++------- resources/meilisearch.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 resources/meilisearch.json diff --git a/Server/Application.cpp b/Server/Application.cpp index 7da26e2..532e77a 100644 --- a/Server/Application.cpp +++ b/Server/Application.cpp @@ -264,14 +264,15 @@ Application::Application(const std::string &path) s.body() = boost::json::serialize(reply); s.prepare_payload(); session.reply(std::move(s)); - }); + }); m_router->insert("/api/v1/search/reindex", [this](HttpSession &session, const Request &request, const boost::urls::matches &matches) { using namespace boost::beast; auto key = getMeiliSearchApiKey(); auto config = getMeiliSearchConfig(); + boost::json::object reply; if (!key.empty() && !config.empty()) { config = std::filesystem::absolute(config); - LOG(info)<<"config path: "< s{boost::beast::http::status::ok, request.version()}; s.set(http::field::server, BOOST_BEAST_VERSION_STRING); s.set(http::field::content_type, "application/json;charset=UTF-8"); s.keep_alive(request.keep_alive()); + s.body() = boost::json::serialize(reply); s.prepare_payload(); session.reply(std::move(s)); }); diff --git a/resources/meilisearch.json b/resources/meilisearch.json new file mode 100644 index 0000000..a3ccdec --- /dev/null +++ b/resources/meilisearch.json @@ -0,0 +1,32 @@ +{ + "index_uid": "amass_blog", + "start_urls": [ + "https://amass.fun/" + ], + "sitemap_urls": [ + "https://amass.fun/sitemap.xml" + ], + "sitemap_alternate_links": true, + "stop_urls": [ + "https://amass.fun/gitea" + ], + "selectors": { + "lvl0": { + "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "type": "xpath", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "header h1", + "lvl2": "article h2", + "lvl3": "article h3", + "lvl4": "article h4", + "lvl5": "article h5, article td:first-child", + "lvl6": "article h6", + "text": "article p, article li, article td:last-child" + }, + "strip_chars": " .,;:#", + "custom_settings": { + }, + "nb_hits": 46250 +}