Try to generate the snippet if it is not present in the database.

We generate the snippet from the content of the article in the zim so
we need to have a access to the reader.
This commit is contained in:
Matthieu Gautier
2017-03-21 16:28:03 +01:00
parent 9be2abedf3
commit 074c1bcffa
3 changed files with 29 additions and 7 deletions

View File

@ -22,6 +22,8 @@
#include <xapian.h>
#include "searcher.h"
#include "reader.h"
#include <map>
#include <string>
@ -58,7 +60,7 @@ namespace kiwix {
class XapianSearcher : public Searcher {
friend class XapianResult;
public:
XapianSearcher(const string &xapianDirectoryPath);
XapianSearcher(const string &xapianDirectoryPath, Reader* reader);
virtual ~XapianSearcher() {};
void searchInIndex(string &search, const unsigned int resultStart, const unsigned int resultEnd,
const bool verbose=false);
@ -69,6 +71,7 @@ namespace kiwix {
void closeIndex();
void openIndex(const string &xapianDirectoryPath);
Reader* reader;
Xapian::Database readableDatabase;
Xapian::Stem stemmer;
Xapian::MSet results;