mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #79 from kiwix/fix_get_html
Always set the humanReadableName with the readable in kiwix-search.
This commit is contained in:
commit
a794849993
|
@ -57,7 +57,9 @@ class Searcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Searcher();
|
Searcher();
|
||||||
Searcher(const string& xapianDirectoryPath, Reader* reader);
|
Searcher(const string& xapianDirectoryPath,
|
||||||
|
Reader* reader,
|
||||||
|
const string& humanReadableName);
|
||||||
~Searcher();
|
~Searcher();
|
||||||
|
|
||||||
void add_reader(Reader* reader, const std::string& humanReaderName);
|
void add_reader(Reader* reader, const std::string& humanReaderName);
|
||||||
|
@ -72,7 +74,6 @@ class Searcher
|
||||||
bool setProtocolPrefix(const std::string prefix);
|
bool setProtocolPrefix(const std::string prefix);
|
||||||
bool setSearchProtocolPrefix(const std::string prefix);
|
bool setSearchProtocolPrefix(const std::string prefix);
|
||||||
void reset();
|
void reset();
|
||||||
void setContentHumanReadableId(const string& contentHumanReadableId);
|
|
||||||
|
|
||||||
#ifdef ENABLE_CTPP2
|
#ifdef ENABLE_CTPP2
|
||||||
string getHtml();
|
string getHtml();
|
||||||
|
|
|
@ -514,7 +514,7 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixlib_JNIKiwix_loadFulltextIndex(
|
||||||
}
|
}
|
||||||
if (!reader || !reader->hasFulltextIndex()) {
|
if (!reader || !reader->hasFulltextIndex()) {
|
||||||
// Use old API (no embedded full text index).
|
// Use old API (no embedded full text index).
|
||||||
searcher = new kiwix::Searcher(cPath, reader);
|
searcher = new kiwix::Searcher(cPath, reader, "");
|
||||||
} else {
|
} else {
|
||||||
// Use the new API. We don't care about the human readable name as
|
// Use the new API. We don't care about the human readable name as
|
||||||
// we don't use it (in android).
|
// we don't use it (in android).
|
||||||
|
|
|
@ -73,7 +73,9 @@ struct SearcherInternal {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
Searcher::Searcher(const string& xapianDirectoryPath, Reader* reader)
|
Searcher::Searcher(const string& xapianDirectoryPath,
|
||||||
|
Reader* reader,
|
||||||
|
const string& humanReadableName)
|
||||||
: internal(new SearcherInternal()),
|
: internal(new SearcherInternal()),
|
||||||
searchPattern(""),
|
searchPattern(""),
|
||||||
protocolPrefix("zim://"),
|
protocolPrefix("zim://"),
|
||||||
|
@ -88,6 +90,8 @@ Searcher::Searcher(const string& xapianDirectoryPath, Reader* reader)
|
||||||
if (!reader || !reader->hasFulltextIndex()) {
|
if (!reader || !reader->hasFulltextIndex()) {
|
||||||
internal->_xapianSearcher = new XapianSearcher(xapianDirectoryPath, reader);
|
internal->_xapianSearcher = new XapianSearcher(xapianDirectoryPath, reader);
|
||||||
}
|
}
|
||||||
|
this->contentHumanReadableId = humanReadableName;
|
||||||
|
this->humanReaderNames.push_back(humanReadableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Searcher::Searcher()
|
Searcher::Searcher()
|
||||||
|
@ -252,11 +256,6 @@ bool Searcher::setSearchProtocolPrefix(const std::string prefix)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Searcher::setContentHumanReadableId(const string& contentHumanReadableId)
|
|
||||||
{
|
|
||||||
this->contentHumanReadableId = contentHumanReadableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
_Result::_Result(Searcher* searcher, zim::Search::iterator& iterator)
|
_Result::_Result(Searcher* searcher, zim::Search::iterator& iterator)
|
||||||
: searcher(searcher), iterator(iterator)
|
: searcher(searcher), iterator(iterator)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue