makeFulltextSearchSuggestion() works via mustache

This commit is contained in:
Veloman Yunkan 2022-01-16 18:02:52 +04:00 committed by Matthieu Gautier
parent a18dd82d82
commit c574735f51
1 changed files with 7 additions and 1 deletions

View File

@ -444,7 +444,13 @@ namespace
std::string makeFulltextSearchSuggestion(const std::string& queryString) std::string makeFulltextSearchSuggestion(const std::string& queryString)
{ {
return "containing '" + queryString + "'..."; MustacheData data;
data.set("SEARCH_TERMS", queryString);
// NOTE: Search terms are **not** HTML-escaped at this point.
// NOTE: HTML-escaping is performed when the result of this function
// NOTE: is expanded into the suggestions.json template
const std::string tmpl("containing '{{{SEARCH_TERMS}}}'...");
return render_template(tmpl, data);
} }
std::string noSuchBookErrorMsg(const std::string& bookName) std::string noSuchBookErrorMsg(const std::string& bookName)