mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
+ template adaptation for using in kiwix-serve
This commit is contained in:
@ -42,7 +42,9 @@ namespace kiwix {
|
||||
resultCountPerPage(0),
|
||||
estimatedResultCount(0),
|
||||
resultStart(0),
|
||||
resultEnd(0) {
|
||||
resultEnd(0),
|
||||
protocolPrefix("zim://"),
|
||||
searchProtocolPrefix("search://?") {
|
||||
}
|
||||
|
||||
/* Search strings in the database */
|
||||
@ -108,6 +110,16 @@ namespace kiwix {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Searcher::setProtocolPrefix(const std::string prefix) {
|
||||
this->protocolPrefix = prefix;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Searcher::setSearchProtocolPrefix(const std::string prefix) {
|
||||
this->searchProtocolPrefix = prefix;
|
||||
return true;
|
||||
}
|
||||
|
||||
string Searcher::getHtml() {
|
||||
|
||||
const STLW::string & sSourceFile = this->resultTemplatePath;
|
||||
@ -201,6 +213,8 @@ namespace kiwix {
|
||||
oData["searchPattern"] = this->searchPattern;
|
||||
oData["resultStart"] = this->resultStart;
|
||||
oData["resultEnd"] = (this->resultEnd > this->estimatedResultCount ? this->estimatedResultCount : this->resultEnd);
|
||||
oData["protocolPrefix"] = this->protocolPrefix;
|
||||
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
||||
|
||||
STLW::string sResult;
|
||||
StringOutputCollector oDataCollector(sResult);
|
||||
|
@ -70,6 +70,8 @@ namespace kiwix {
|
||||
bool getNextResult(string &url, string &title, unsigned int &score);
|
||||
unsigned int getEstimatedResultCount();
|
||||
bool setResultTemplatePath(const std::string path);
|
||||
bool setProtocolPrefix(const std::string prefix);
|
||||
bool setSearchProtocolPrefix(const std::string prefix);
|
||||
string getHtml();
|
||||
void reset();
|
||||
|
||||
@ -87,6 +89,8 @@ namespace kiwix {
|
||||
unsigned int estimatedResultCount;
|
||||
unsigned int resultStart;
|
||||
unsigned int resultEnd;
|
||||
std::string protocolPrefix;
|
||||
std::string searchProtocolPrefix;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user