Remove get_readerIndex in favor of get_zimId

The function get_readerIndex was used to get the zimId using an ordered
vector of readers. Now we can use get_zimId directly.
This commit is contained in:
Maneesh P M 2021-05-17 19:23:43 +05:30 committed by Matthieu Gautier
parent c35f6f9142
commit e2f6d91d51
3 changed files with 1 additions and 9 deletions

View File

@ -48,7 +48,6 @@ class Result
virtual std::string get_content() = 0;
virtual int get_wordCount() = 0;
virtual int get_size() = 0;
virtual int get_readerIndex() = 0;
virtual std::string get_zimId() = 0;
};

View File

@ -77,9 +77,7 @@ std::string SearchRenderer::getHtml()
result.set("title", p_result->get_title());
result.set("url", p_result->get_url());
result.set("snippet", p_result->get_snippet());
auto readerIndex = p_result->get_readerIndex();
auto reader = mp_searcher->get_reader(readerIndex);
result.set("resultContentId", mp_nameMapper->getNameForId(reader->getId()));
result.set("resultContentId", mp_nameMapper->getNameForId(p_result->get_zimId()));
if (p_result->get_wordCount() >= 0) {
result.set("wordCount", kiwix::beautifyInteger(p_result->get_wordCount()));

View File

@ -45,7 +45,6 @@ class _Result : public Result
virtual std::string get_content();
virtual int get_wordCount();
virtual int get_size();
virtual int get_readerIndex();
virtual std::string get_zimId();
private:
@ -262,10 +261,6 @@ int _Result::get_wordCount()
{
return iterator.getWordCount();
}
int _Result::get_readerIndex()
{
return iterator.getFileIndex();
}
std::string _Result::get_zimId()
{
std::ostringstream s;