Changeset View
Changeset View
Standalone View
Standalone View
src/engine/fuzzydb.h
- This file was added.
1 | #ifndef BALOO_FUZZYDB_H | ||||
---|---|---|---|---|---|
2 | #define BALOO_FUZZYDB_H | ||||
3 | | ||||
4 | #include "postingiterator.h" | ||||
5 | #include "documentdb.h" | ||||
6 | #include "postingdb.h" | ||||
7 | | ||||
8 | #include "lmdb.h" | ||||
9 | | ||||
10 | namespace Baloo { | ||||
11 | | ||||
12 | /** | ||||
13 | * The FuzzyDB is used to implement fuzzy search on filenames. | ||||
14 | * It does so by computing the bi-grams of each term and matching | ||||
15 | * them to the inverted index (this database). | ||||
16 | */ | ||||
17 | class BALOO_ENGINE_EXPORT FuzzyDB | ||||
18 | { | ||||
19 | public: | ||||
20 | FuzzyDB(MDB_dbi, MDB_txn* txn); | ||||
21 | ~FuzzyDB(); | ||||
22 | | ||||
23 | static MDB_dbi create(MDB_txn* txn); | ||||
24 | static MDB_dbi open(MDB_txn* txn); | ||||
25 | | ||||
26 | void sync_terms(const DocumentDB& filename_terms); | ||||
27 | | ||||
28 | void put(const QByteArray& bigram, const PostingList& list); | ||||
29 | PostingList get(const QByteArray& bigram); | ||||
30 | | ||||
31 | PostingIterator* iter(const QByteArray& term); | ||||
32 | | ||||
33 | private: | ||||
34 | MDB_txn* m_txn; | ||||
35 | MDB_dbi m_dbi; | ||||
36 | | ||||
37 | QStringList into_bigrams(const QString& term); | ||||
38 | | ||||
39 | QByteArray raw_get(const QByteArray& bigram); | ||||
40 | }; | ||||
41 | } | ||||
42 | | ||||
43 | #endif // BALOO_FUZZYDB_H |