+ getEstimatedResultCount()

This commit is contained in:
kelson42 2011-03-18 13:51:41 +00:00
parent 5e162d6f47
commit 8878f4e8f3
3 changed files with 14 additions and 3 deletions

View File

@ -22,12 +22,13 @@
namespace kiwix {
/* Constructor */
Searcher::Searcher() {
Searcher::Searcher() :
estimatedResultCount(0) {
}
/* Search strings in the database */
void Searcher::search(std::string &search, const unsigned int resultsCount, const bool verbose) {
this->reset();
if (verbose == true) {
@ -44,8 +45,14 @@ 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) {

View File

@ -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;
};
}

View File

@ -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;
}
}