From 8f699879291e1cc02c6b7b9a10584afe3e6df1d8 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Mon, 16 Apr 2012 23:21:37 +0000 Subject: [PATCH] + last improvement of the new kiwix-serve --- src/common/kiwix/searcher.cpp | 6 +++++- src/common/kiwix/searcher.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) 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; };