diff --git a/src/common/kiwix/searcher.cpp b/src/common/kiwix/searcher.cpp index 50b3860c9..4c31a76a7 100644 --- a/src/common/kiwix/searcher.cpp +++ b/src/common/kiwix/searcher.cpp @@ -121,6 +121,10 @@ namespace kiwix { return true; } + void Searcher::setContentHumanReadableId(const string &contentHumanReadableId) { + this->contentHumanReadableId = contentHumanReadableId; + } + string Searcher::getHtml() { const STLW::string & sSourceFile = this->resultTemplatePath; @@ -171,7 +175,7 @@ namespace kiwix { while (this->resultOffset != this->results.end()) { CDT result; result["title"] = this->resultOffset->title; - result["url"] = this->resultOffset->url; + result["url"] = this->contentHumanReadableId + "/" + this->resultOffset->url; result["snippet"] = this->resultOffset->snippet; if (this->resultOffset->size >= 0) diff --git a/src/common/kiwix/searcher.h b/src/common/kiwix/searcher.h index bdc0700cb..dba32a902 100644 --- a/src/common/kiwix/searcher.h +++ b/src/common/kiwix/searcher.h @@ -74,6 +74,7 @@ namespace kiwix { bool setSearchProtocolPrefix(const std::string prefix); string getHtml(); void reset(); + void setContentHumanReadableId(const string &contentHumanReadableId); protected: std::string beautifyInteger(const unsigned int number); @@ -91,6 +92,7 @@ namespace kiwix { unsigned int resultEnd; std::string protocolPrefix; std::string searchProtocolPrefix; + std::string contentHumanReadableId; unsigned int resultRange; };