2020-12-30 15:31:36 +08:00
|
|
|
#ifndef DOCUMENT_H
|
|
|
|
#define DOCUMENT_H
|
|
|
|
|
|
|
|
#include <xapian.h>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
2021-01-02 17:21:38 +08:00
|
|
|
#include <QVector>
|
2020-12-30 15:31:36 +08:00
|
|
|
|
|
|
|
class Document
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Document();
|
|
|
|
~Document();
|
|
|
|
void setData(QString data);
|
2021-01-13 11:02:15 +08:00
|
|
|
void addPosting(std::string term, QVector<size_t> offset, int weight =1);
|
|
|
|
void addTerm(QString term);
|
2020-12-30 15:31:36 +08:00
|
|
|
void addValue(QString value);
|
|
|
|
void setUniqueTerm(QString term);
|
|
|
|
std::string getUniqueTerm();
|
|
|
|
void setIndexText(QStringList indexText);
|
|
|
|
QStringList getIndexText();
|
|
|
|
Xapian::Document getXapianDocument();
|
|
|
|
private:
|
|
|
|
Xapian::Document *m_document;
|
|
|
|
QStringList *m_index_text;
|
|
|
|
QString *m_unique_term;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DOCUMENT_H
|