author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team. |
|
4 |
** All rights reserved. |
|
5 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
6 |
** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 7 |
** All rights reserved. |
8 |
** |
|
9 |
** This file may be used under the terms of the GNU Lesser General Public |
|
10 |
** License version 2.1 as published by the Free Software Foundation and |
|
11 |
** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
12 |
** Please review the following information to ensure the GNU Lesser General |
|
13 |
** Public License version 2.1 requirements will be met: |
|
14 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
15 |
** |
|
16 |
****************************************************************************/ |
|
17 |
||
18 |
#ifndef QINDEXREADER_P_H |
|
19 |
#define QINDEXREADER_P_H |
|
20 |
||
21 |
// |
|
22 |
// W A R N I N G |
|
23 |
// ------------- |
|
24 |
// |
|
25 |
// This file is not part of the Qt API. It exists for the convenience |
|
26 |
// of the help generator tools. This header file may change from version |
|
27 |
// to version without notice, or even be removed. |
|
28 |
// |
|
29 |
// We mean it. |
|
30 |
// |
|
31 |
||
32 |
#include "qterm_p.h" |
|
33 |
#include "qdocument_p.h" |
|
34 |
#include "qclucene_global_p.h" |
|
35 |
||
36 |
#include <QtCore/QList> |
|
37 |
#include <QtCore/QString> |
|
38 |
#include <QtCore/QSharedDataPointer> |
|
39 |
#include <QtCore/QSharedData> |
|
40 |
||
41 |
CL_NS_DEF(index) |
|
42 |
class IndexReader; |
|
43 |
CL_NS_END |
|
44 |
CL_NS_USE(index) |
|
45 |
||
46 |
QT_BEGIN_NAMESPACE |
|
47 |
||
48 |
class QCLuceneIndexWriter; |
|
49 |
class QCLuceneIndexSearcher; |
|
50 |
||
51 |
class QHELP_EXPORT QCLuceneIndexReaderPrivate : public QSharedData |
|
52 |
{ |
|
53 |
public: |
|
54 |
QCLuceneIndexReaderPrivate(); |
|
55 |
QCLuceneIndexReaderPrivate(const QCLuceneIndexReaderPrivate &other); |
|
56 |
||
57 |
~QCLuceneIndexReaderPrivate(); |
|
58 |
||
59 |
IndexReader *reader; |
|
60 |
bool deleteCLuceneIndexReader; |
|
61 |
||
62 |
private: |
|
63 |
QCLuceneIndexReaderPrivate &operator=(const QCLuceneIndexReaderPrivate &other); |
|
64 |
}; |
|
65 |
||
66 |
class QHELP_EXPORT QCLuceneIndexReader |
|
67 |
{ |
|
68 |
public: |
|
69 |
enum FieldOption { |
|
70 |
ALL = 1, |
|
71 |
INDEXED = 2, |
|
72 |
UNINDEXED = 4, |
|
73 |
INDEXED_WITH_TERMVECTOR = 8, |
|
74 |
INDEXED_NO_TERMVECTOR = 16, |
|
75 |
TERMVECTOR = 32, |
|
76 |
TERMVECTOR_WITH_POSITION = 64, |
|
77 |
TERMVECTOR_WITH_OFFSET = 128, |
|
78 |
TERMVECTOR_WITH_POSITION_OFFSET = 256 |
|
79 |
}; |
|
80 |
||
81 |
virtual ~QCLuceneIndexReader(); |
|
82 |
||
83 |
static bool isLuceneFile(const QString &filename); |
|
84 |
static bool indexExists(const QString &directory); |
|
85 |
static QCLuceneIndexReader open(const QString &path); |
|
86 |
||
87 |
static void unlock(const QString &path); |
|
88 |
static bool isLocked(const QString &directory); |
|
89 |
||
90 |
static quint64 lastModified(const QString &directory); |
|
91 |
static qint64 getCurrentVersion(const QString &directory); |
|
92 |
||
93 |
void close(); |
|
94 |
bool isCurrent(); |
|
95 |
void undeleteAll(); |
|
96 |
qint64 getVersion(); |
|
97 |
void deleteDocument(qint32 docNum); |
|
98 |
bool hasNorms(const QString &field); |
|
99 |
qint32 deleteDocuments(const QCLuceneTerm &term); |
|
100 |
bool document(qint32 index, QCLuceneDocument &document); |
|
101 |
void setNorm(qint32 doc, const QString &field, qreal value); |
|
102 |
void setNorm(qint32 doc, const QString &field, quint8 value); |
|
103 |
||
104 |
protected: |
|
105 |
friend class QCLuceneIndexWriter; |
|
106 |
friend class QCLuceneIndexSearcher; |
|
107 |
QSharedDataPointer<QCLuceneIndexReaderPrivate> d; |
|
108 |
||
109 |
private: |
|
110 |
QCLuceneIndexReader(); |
|
111 |
}; |
|
112 |
||
113 |
QT_END_NAMESPACE |
|
114 |
||
115 |
#endif // QINDEXREADER_P_H |