mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #99 from kiwix/better_search_result_html
Better search result html
This commit is contained in:
commit
281b136ea8
|
@ -56,7 +56,7 @@ struct SearcherInternal;
|
|||
class Searcher
|
||||
{
|
||||
public:
|
||||
Searcher();
|
||||
Searcher(const string& humanReadableName = "");
|
||||
Searcher(const string& xapianDirectoryPath,
|
||||
Reader* reader,
|
||||
const string& humanReadableName);
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "searcher.h"
|
||||
#include "kiwixlib-resources.h"
|
||||
#include "reader.h"
|
||||
|
@ -85,17 +88,17 @@ Searcher::Searcher(const string& xapianDirectoryPath,
|
|||
resultCountPerPage(0),
|
||||
estimatedResultCount(0),
|
||||
resultStart(0),
|
||||
resultEnd(0)
|
||||
resultEnd(0),
|
||||
contentHumanReadableId(humanReadableName)
|
||||
{
|
||||
loadICUExternalTables();
|
||||
if (!reader || !reader->hasFulltextIndex()) {
|
||||
internal->_xapianSearcher = new XapianSearcher(xapianDirectoryPath, reader);
|
||||
}
|
||||
this->contentHumanReadableId = humanReadableName;
|
||||
this->humanReaderNames.push_back(humanReadableName);
|
||||
}
|
||||
|
||||
Searcher::Searcher()
|
||||
Searcher::Searcher(const std::string& humanReadableName)
|
||||
: internal(new SearcherInternal()),
|
||||
searchPattern(""),
|
||||
protocolPrefix("zim://"),
|
||||
|
@ -103,7 +106,8 @@ Searcher::Searcher()
|
|||
resultCountPerPage(0),
|
||||
estimatedResultCount(0),
|
||||
resultStart(0),
|
||||
resultEnd(0)
|
||||
resultEnd(0),
|
||||
contentHumanReadableId(humanReadableName)
|
||||
{
|
||||
loadICUExternalTables();
|
||||
}
|
||||
|
@ -431,7 +435,7 @@ string Searcher::getHtml()
|
|||
oData["resultRange"] = this->resultCountPerPage;
|
||||
oData["resultLastPageStart"]
|
||||
= this->estimatedResultCount > this->resultCountPerPage
|
||||
? this->estimatedResultCount - this->resultCountPerPage
|
||||
? std::round(this->estimatedResultCount / this->resultCountPerPage) * this->resultCountPerPage
|
||||
: 0;
|
||||
oData["protocolPrefix"] = this->protocolPrefix;
|
||||
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
||||
|
|
Loading…
Reference in New Issue