|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team. |
|
4 ** All rights reserved. |
|
5 ** |
|
6 ** Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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 QSEARCHABLE_P_H |
|
19 #define QSEARCHABLE_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 "qhits_p.h" |
|
33 #include "qsort_p.h" |
|
34 #include "qquery_p.h" |
|
35 #include "qfilter_p.h" |
|
36 #include "qdocument_p.h" |
|
37 #include "qindexreader_p.h" |
|
38 #include "qclucene_global_p.h" |
|
39 |
|
40 #include <QtCore/QList> |
|
41 #include <QtCore/QString> |
|
42 #include <QtCore/QSharedDataPointer> |
|
43 #include <QtCore/QSharedData> |
|
44 |
|
45 CL_NS_DEF(search) |
|
46 class Searcher; |
|
47 CL_NS_END |
|
48 CL_NS_USE(search) |
|
49 |
|
50 QT_BEGIN_NAMESPACE |
|
51 |
|
52 class QCLuceneHits; |
|
53 class QCLuceneSearcher; |
|
54 class QCLuceneIndexSearcher; |
|
55 class QCLuceneMultiSearcher; |
|
56 |
|
57 class QHELP_EXPORT QCLuceneSearchablePrivate : public QSharedData |
|
58 { |
|
59 public: |
|
60 QCLuceneSearchablePrivate(); |
|
61 QCLuceneSearchablePrivate(const QCLuceneSearchablePrivate &other); |
|
62 |
|
63 ~QCLuceneSearchablePrivate(); |
|
64 |
|
65 Searcher *searchable; |
|
66 bool deleteCLuceneSearchable; |
|
67 |
|
68 private: |
|
69 QCLuceneSearchablePrivate &operator=(const QCLuceneSearchablePrivate &other); |
|
70 }; |
|
71 |
|
72 class QHELP_EXPORT QCLuceneSearchable |
|
73 { |
|
74 public: |
|
75 virtual ~QCLuceneSearchable(); |
|
76 |
|
77 protected: |
|
78 friend class QCLuceneSearcher; |
|
79 friend class QCLuceneIndexSearcher; |
|
80 friend class QCLuceneMultiSearcher; |
|
81 QSharedDataPointer<QCLuceneSearchablePrivate> d; |
|
82 |
|
83 private: |
|
84 QCLuceneSearchable(); |
|
85 }; |
|
86 |
|
87 class QHELP_EXPORT QCLuceneSearcher : public QCLuceneSearchable |
|
88 { |
|
89 public: |
|
90 QCLuceneSearcher(); |
|
91 virtual ~QCLuceneSearcher(); |
|
92 |
|
93 QCLuceneHits search(const QCLuceneQuery &query); |
|
94 QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneFilter &filter); |
|
95 QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneSort &sort); |
|
96 QCLuceneHits search(const QCLuceneQuery &query, const QCLuceneFilter &filter, |
|
97 const QCLuceneSort &sort); |
|
98 |
|
99 protected: |
|
100 friend class QCLuceneHits; |
|
101 }; |
|
102 |
|
103 class QHELP_EXPORT QCLuceneIndexSearcher : public QCLuceneSearcher |
|
104 { |
|
105 public: |
|
106 QCLuceneIndexSearcher(const QString &path); |
|
107 QCLuceneIndexSearcher(const QCLuceneIndexReader &reader); |
|
108 ~QCLuceneIndexSearcher(); |
|
109 |
|
110 void close(); |
|
111 qint32 maxDoc() const; |
|
112 QCLuceneIndexReader getReader(); |
|
113 bool doc(qint32 i, QCLuceneDocument &document); |
|
114 |
|
115 private: |
|
116 QCLuceneIndexReader reader; |
|
117 }; |
|
118 |
|
119 class QHELP_EXPORT QCLuceneMultiSearcher : public QCLuceneSearcher |
|
120 { |
|
121 public: |
|
122 QCLuceneMultiSearcher(const QList<QCLuceneSearchable> searchables); |
|
123 ~QCLuceneMultiSearcher(); |
|
124 |
|
125 void close(); |
|
126 qint32 maxDoc() const; |
|
127 qint32 subDoc(qint32 index) const; |
|
128 qint32 subSearcher(qint32 index) const; |
|
129 qint32 searcherIndex(qint32 index) const; |
|
130 bool doc(qint32 i, QCLuceneDocument &document); |
|
131 }; |
|
132 |
|
133 QT_END_NAMESPACE |
|
134 |
|
135 #endif // QSEARCHABLE_P_H |