File: xapianqueryparser.h

package info (click to toggle)
akonadi-search 4%3A18.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,260 kB
  • sloc: cpp: 9,607; xml: 73; makefile: 7; sh: 1
file content (60 lines) | stat: -rw-r--r-- 1,767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * <one line to give the library's name and an idea of what it does.>
 * Copyright (C) 2014  Vishesh Handa <me@vhanda.in>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef AKONADI_SEARCH_QUERYPARSER_H
#define AKONADI_SEARCH_QUERYPARSER_H

#include <QString>
#include <xapian.h>
#include "search_xapian_export.h"

namespace Akonadi
{
namespace Search
{

class AKONADI_SEARCH_XAPIAN_EXPORT XapianQueryParser
{
public:
    XapianQueryParser();

    void setDatabase(Xapian::Database *db);
    Xapian::Query parseQuery(const QString &str, const QString &prefix = QString());

    /**
     * Expands word to every possible option which it can be expanded to.
     */
    Xapian::Query expandWord(const QString &word, const QString &prefix = QString());

    /**
     * Set if each word in the string should be treated as a partial word
     * and should be expanded to every possible word.
     */
    void setAutoExapand(bool autoexpand);

private:
    Xapian::Database *m_db = nullptr;
    bool m_autoExpand;
};

}
}

#endif // AKONADI_SEARCH_QUERYPARSER_H