mirror of https://github.com/kiwix/libkiwix.git
Add Reader::hasFulltextIndex
This commit is contained in:
parent
86200dce7e
commit
e3c2a13fa6
|
@ -516,8 +516,14 @@ namespace kiwix {
|
||||||
char ns = 0;
|
char ns = 0;
|
||||||
string titleStr;
|
string titleStr;
|
||||||
this->parseUrl(url, &ns, titleStr);
|
this->parseUrl(url, &ns, titleStr);
|
||||||
|
titleStr = "/" + titleStr;
|
||||||
zim::File::const_iterator findItr = zimFileHandler->find(ns, titleStr);
|
zim::File::const_iterator findItr = zimFileHandler->find(ns, titleStr);
|
||||||
return findItr->getUrl() == titleStr;
|
return findItr != zimFileHandler->end() && findItr->getUrl() == titleStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Does the ZIM file has a fulltext index */
|
||||||
|
bool Reader::hasFulltextIndex() {
|
||||||
|
return this->urlExists("/Z/fulltextIndex/xapian");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search titles by prefix */
|
/* Search titles by prefix */
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace kiwix {
|
||||||
bool searchSuggestions(const string &prefix, unsigned int suggestionsCount, const bool reset = true);
|
bool searchSuggestions(const string &prefix, unsigned int suggestionsCount, const bool reset = true);
|
||||||
bool searchSuggestionsSmart(const string &prefix, unsigned int suggestionsCount);
|
bool searchSuggestionsSmart(const string &prefix, unsigned int suggestionsCount);
|
||||||
bool urlExists(const string &url);
|
bool urlExists(const string &url);
|
||||||
|
bool hasFulltextIndex();
|
||||||
std::vector<std::string> getTitleVariants(const std::string &title);
|
std::vector<std::string> getTitleVariants(const std::string &title);
|
||||||
bool getNextSuggestion(string &title);
|
bool getNextSuggestion(string &title);
|
||||||
bool getNextSuggestion(string &title, string &url);
|
bool getNextSuggestion(string &title, string &url);
|
||||||
|
|
Loading…
Reference in New Issue