mirror of https://github.com/kiwix/libkiwix.git
+ getEstimatedResultCount()
This commit is contained in:
parent
5e162d6f47
commit
8878f4e8f3
|
@ -22,7 +22,8 @@
|
|||
namespace kiwix {
|
||||
|
||||
/* Constructor */
|
||||
Searcher::Searcher() {
|
||||
Searcher::Searcher() :
|
||||
estimatedResultCount(0) {
|
||||
}
|
||||
|
||||
/* Search strings in the database */
|
||||
|
@ -44,9 +45,15 @@ namespace kiwix {
|
|||
void Searcher::reset() {
|
||||
this->results.clear();
|
||||
this->resultOffset = this->results.begin();
|
||||
this->estimatedResultCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return the result count estimation */
|
||||
const unsigned int Searcher::getEstimatedResultCount() {
|
||||
return this->estimatedResultCount;
|
||||
}
|
||||
|
||||
/* Get next result */
|
||||
bool Searcher::getNextResult(string &url, string &title, unsigned int &score) {
|
||||
bool retVal = false;
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace kiwix {
|
|||
|
||||
void search(std::string &search, const unsigned int resultsCount, const bool verbose=false);
|
||||
bool getNextResult(string &url, string &title, unsigned int &score);
|
||||
const unsigned int getEstimatedResultCount();
|
||||
void reset();
|
||||
const string getHtml();
|
||||
|
||||
|
@ -70,6 +71,7 @@ namespace kiwix {
|
|||
|
||||
std::vector<Result> results;
|
||||
std::vector<Result>::iterator resultOffset;
|
||||
unsigned int estimatedResultCount;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -67,9 +67,11 @@ namespace kiwix {
|
|||
std::cout << i.get_percent() << "% ";
|
||||
std::cout << "\t[" << doc.get_data() << "] - " << doc.get_value(0) << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Update the global resultCount value*/
|
||||
this->estimatedResultCount = matches.get_matches_estimated();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue