Akonadi Search

xapiandocument.h
1/*
2 * SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 */
7
8#pragma once
9
10#include <QString>
11#include <xapian.h>
12
13#include "search_xapian_export.h"
14#include "xapiantermgenerator.h"
15
16namespace Akonadi
17{
18namespace Search
19{
20/**
21 * This class is just a light wrapper over Xapian::Document
22 * which provides nice Qt apis.
23 */
24class AKONADI_SEARCH_XAPIAN_EXPORT XapianDocument
25{
26public:
28 XapianDocument(const Xapian::Document &doc);
29
30 void addTerm(const QString &term, const QString &prefix = QString());
31 void addBoolTerm(const QString &term, const QString &prefix = QString());
32 void addBoolTerm(int term, const QString &prefix);
33
34 void indexText(const QString &text, int wdfInc = 1);
35 void indexText(const QString &text, const QString &prefix, int wdfInc = 1);
36
37 void addValue(int pos, const QString &value);
38
39 [[nodiscard]] Xapian::Document doc() const;
40
41 [[nodiscard]] QString fetchTermStartsWith(const QByteArray &term);
42
43 /**
44 * Remove all the terms which start with the prefix \p prefix
45 *
46 * \return true if the document was modified
47 */
48 [[nodiscard]] bool removeTermStartsWith(const QByteArray &prefix);
49
50private:
51 Xapian::Document m_doc;
52 XapianTermGenerator m_termGen;
53};
54}
55}
This class is just a light wrapper over Xapian::Document which provides nice Qt apis.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:56:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.