Introduced makeFulltextSearchSuggestion() helper

This commit is contained in:
Veloman Yunkan 2022-03-24 19:12:16 +04:00 committed by Matthieu Gautier
parent e22e073d43
commit a18dd82d82
1 changed files with 6 additions and 1 deletions

View File

@ -442,6 +442,11 @@ SuggestionsList_t getSuggestions(SuggestionSearcherCache& cache, const zim::Arch
namespace namespace
{ {
std::string makeFulltextSearchSuggestion(const std::string& queryString)
{
return "containing '" + queryString + "'...";
}
std::string noSuchBookErrorMsg(const std::string& bookName) std::string noSuchBookErrorMsg(const std::string& bookName)
{ {
return "No such book: " + bookName; return "No such book: " + bookName;
@ -514,7 +519,7 @@ std::unique_ptr<Response> InternalServer::handle_suggest(const RequestContext& r
/* Propose the fulltext search if possible */ /* Propose the fulltext search if possible */
if (archive->hasFulltextIndex()) { if (archive->hasFulltextIndex()) {
MustacheData result; MustacheData result;
result.set("label", "containing '" + queryString + "'..."); result.set("label", makeFulltextSearchSuggestion(queryString));
result.set("value", queryString + " "); result.set("value", queryString + " ");
result.set("kind", "pattern"); result.set("kind", "pattern");
result.set("first", first); result.set("first", first);