Add `get_zimId` method to Result

get_zimId method allows the user to get the uuid of the archive from
which a result is retrieved directly from the search result itself.
This commit is contained in:
Maneesh P M 2021-05-13 12:59:48 +05:30 committed by Matthieu Gautier
parent 7f0d3004c9
commit c35f6f9142
2 changed files with 8 additions and 0 deletions

View File

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

View File

@ -46,6 +46,7 @@ class _Result : public Result
virtual int get_wordCount();
virtual int get_size();
virtual int get_readerIndex();
virtual std::string get_zimId();
private:
zim::SearchResultSet::iterator iterator;
@ -265,6 +266,12 @@ int _Result::get_readerIndex()
{
return iterator.getFileIndex();
}
std::string _Result::get_zimId()
{
std::ostringstream s;
s << iterator.getZimId();
return s.str();
}
}