summaryrefslogtreecommitdiff
path: root/source/l/qt/patches/qt-everywhere-opensource-src-4.8.6-system-clucene.patch
blob: 63a746290be6fb7e26726c3a0f85733fd6dfee78 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/fulltextsearch.pri qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/fulltextsearch.pri
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/fulltextsearch.pri	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/fulltextsearch.pri	2014-10-26 03:33:45.000000000 +0100
@@ -1,125 +1,7 @@
-DEFINES += _BUILD_FOR_QT_ LUCENE_DISABLE_MEMTRACKING
-win32:DEFINES += _CRT_SECURE_NO_DEPRECATE _MT
-
-CLUCENEDIR = ../../../../src/3rdparty/clucene/src/CLucene
-
-INCLUDEPATH += . .. \
-               $$CLUCENEDIR \
-               $$CLUCENEDIR/../ \
-               $$CLUCENEDIR/analysis \
-               $$CLUCENEDIR/analysis/standard \
-               $$CLUCENEDIR/config \
-               $$CLUCENEDIR/debug \
-               $$CLUCENEDIR/document \
-               $$CLUCENEDIR/index \
-               $$CLUCENEDIR/queryParser \
-               $$CLUCENEDIR/search \
-               $$CLUCENEDIR/store \
-               $$CLUCENEDIR/util
-
-
-SOURCES += $$CLUCENEDIR/StdHeader.cpp \
-           $$CLUCENEDIR/analysis/AnalysisHeader.cpp \
-           $$CLUCENEDIR/analysis/Analyzers.cpp \
-           $$CLUCENEDIR/config/gunichartables.cpp \
-           $$CLUCENEDIR/config/repl_lltot.cpp \
-           $$CLUCENEDIR/config/repl_tcscasecmp.cpp \
-           $$CLUCENEDIR/config/repl_tcslwr.cpp \
-           $$CLUCENEDIR/config/repl_tcstod.cpp \
-           $$CLUCENEDIR/config/repl_tcstoll.cpp \
-           $$CLUCENEDIR/config/repl_tprintf.cpp \
-           $$CLUCENEDIR/config/threads.cpp \
-           $$CLUCENEDIR/config/utf8.cpp \
-           $$CLUCENEDIR/debug/condition.cpp \
-           $$CLUCENEDIR/debug/error.cpp \
-           $$CLUCENEDIR/debug/memtracking.cpp \
-           $$CLUCENEDIR/document/DateField.cpp \
-           $$CLUCENEDIR/document/Document.cpp \
-           $$CLUCENEDIR/document/Field.cpp \
-           $$CLUCENEDIR/index/CompoundFile.cpp \
-           $$CLUCENEDIR/index/DocumentWriter.cpp \
-           $$CLUCENEDIR/index/FieldInfos.cpp \
-           $$CLUCENEDIR/index/FieldsReader.cpp \
-           $$CLUCENEDIR/index/FieldsWriter.cpp \
-           $$CLUCENEDIR/index/IndexModifier.cpp \
-           $$CLUCENEDIR/index/IndexReader.cpp \
-           $$CLUCENEDIR/index/IndexWriter.cpp \
-           $$CLUCENEDIR/index/MultiReader.cpp \
-           $$CLUCENEDIR/index/SegmentInfos.cpp \
-           $$CLUCENEDIR/index/SegmentMergeInfo.cpp \
-           $$CLUCENEDIR/index/SegmentMergeQueue.cpp \
-           $$CLUCENEDIR/index/SegmentMerger.cpp \
-           $$CLUCENEDIR/index/SegmentReader.cpp \
-           $$CLUCENEDIR/index/SegmentTermDocs.cpp \
-           $$CLUCENEDIR/index/SegmentTermEnum.cpp \
-           $$CLUCENEDIR/index/SegmentTermPositions.cpp \
-           $$CLUCENEDIR/index/SegmentTermVector.cpp \
-           $$CLUCENEDIR/index/Term.cpp \
-           $$CLUCENEDIR/index/TermInfo.cpp \
-           $$CLUCENEDIR/index/TermInfosReader.cpp \
-           $$CLUCENEDIR/index/TermInfosWriter.cpp \
-           $$CLUCENEDIR/index/TermVectorReader.cpp \
-           $$CLUCENEDIR/index/TermVectorWriter.cpp \
-           $$CLUCENEDIR/queryParser/Lexer.cpp \
-           $$CLUCENEDIR/queryParser/MultiFieldQueryParser.cpp \
-           $$CLUCENEDIR/queryParser/QueryParser.cpp \
-           $$CLUCENEDIR/queryParser/QueryParserBase.cpp \
-           $$CLUCENEDIR/queryParser/QueryToken.cpp \
-           $$CLUCENEDIR/queryParser/TokenList.cpp \
-           $$CLUCENEDIR/search/BooleanQuery.cpp \
-           $$CLUCENEDIR/search/BooleanScorer.cpp \
-           $$CLUCENEDIR/search/CachingWrapperFilter.cpp \
-           $$CLUCENEDIR/search/ChainedFilter.cpp \
-           $$CLUCENEDIR/search/ConjunctionScorer.cpp \
-           $$CLUCENEDIR/search/DateFilter.cpp \
-           $$CLUCENEDIR/search/ExactPhraseScorer.cpp \
-           $$CLUCENEDIR/search/Explanation.cpp \
-           $$CLUCENEDIR/search/FieldCache.cpp \
-           $$CLUCENEDIR/search/FieldCacheImpl.cpp \
-           $$CLUCENEDIR/search/FieldDocSortedHitQueue.cpp \
-           $$CLUCENEDIR/search/FieldSortedHitQueue.cpp \
-           $$CLUCENEDIR/search/FilteredTermEnum.cpp \
-           $$CLUCENEDIR/search/FuzzyQuery.cpp \
-           $$CLUCENEDIR/search/HitQueue.cpp \
-           $$CLUCENEDIR/search/Hits.cpp \
-           $$CLUCENEDIR/search/IndexSearcher.cpp \
-           $$CLUCENEDIR/search/MultiSearcher.cpp \
-           $$CLUCENEDIR/search/MultiTermQuery.cpp \
-           $$CLUCENEDIR/search/PhrasePositions.cpp \
-           $$CLUCENEDIR/search/PhraseQuery.cpp \
-           $$CLUCENEDIR/search/PhraseScorer.cpp \
-           $$CLUCENEDIR/search/PrefixQuery.cpp \
-           $$CLUCENEDIR/search/QueryFilter.cpp \
-           $$CLUCENEDIR/search/RangeFilter.cpp \
-           $$CLUCENEDIR/search/RangeQuery.cpp \
-           $$CLUCENEDIR/search/SearchHeader.cpp \
-           $$CLUCENEDIR/search/Similarity.cpp \
-           $$CLUCENEDIR/search/SloppyPhraseScorer.cpp \
-           $$CLUCENEDIR/search/Sort.cpp \
-           $$CLUCENEDIR/search/TermQuery.cpp \
-           $$CLUCENEDIR/search/TermScorer.cpp \
-           $$CLUCENEDIR/search/WildcardQuery.cpp \
-           $$CLUCENEDIR/search/WildcardTermEnum.cpp \
-           $$CLUCENEDIR/store/FSDirectory.cpp \
-           $$CLUCENEDIR/store/IndexInput.cpp \
-           $$CLUCENEDIR/store/IndexOutput.cpp \
-           $$CLUCENEDIR/store/Lock.cpp \
-           $$CLUCENEDIR/store/MMapInput.cpp \
-           $$CLUCENEDIR/store/RAMDirectory.cpp \
-           $$CLUCENEDIR/store/TransactionalRAMDirectory.cpp \
-           $$CLUCENEDIR/util/BitSet.cpp \
-           $$CLUCENEDIR/util/Equators.cpp \
-           $$CLUCENEDIR/util/FastCharStream.cpp \
-           $$CLUCENEDIR/util/fileinputstream.cpp \
-           $$CLUCENEDIR/util/Misc.cpp \
-           $$CLUCENEDIR/util/Reader.cpp \
-           $$CLUCENEDIR/util/StringBuffer.cpp \
-           $$CLUCENEDIR/util/StringIntern.cpp \
-           $$CLUCENEDIR/util/ThreadLocal.cpp \
-           $$CLUCENEDIR/analysis/standard/StandardAnalyzer.cpp \
-           $$CLUCENEDIR/analysis/standard/StandardFilter.cpp \
-           $$CLUCENEDIR/analysis/standard/StandardTokenizer.cpp
 
+INCLUDEPATH += /usr/include/clucene09 $$[QT_INSTALL_LIBS]/clucene09 $$[QT_INSTALL_LIBS]
+LIBS += -L$$[QT_INSTALL_LIBS]/clucene09 -lclucene
+#DEFINES += LUCENE_ENABLE_REFCOUNT (must be set at CLucene build time!)
 
 #Header files
 HEADERS += qclucene_global_p.h \
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene-config_p.h qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qclucene-config_p.h
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene-config_p.h	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qclucene-config_p.h	2014-10-26 02:28:54.000000000 +0100
@@ -15,6 +15,8 @@
 **
 ****************************************************************************/
 
+#error This header must not be included when building against system CLucene.
+
 #ifndef QCLUCENE_CONFIG_P_H
 #define QCLUCENE_CONFIG_P_H
 
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene_global_p.h qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qclucene_global_p.h
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene_global_p.h	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qclucene_global_p.h	2014-10-26 02:31:54.000000000 +0100
@@ -29,20 +29,10 @@
 // We mean it.
 //
 
-#if !defined(_MSC_VER)
-#   include "qclucene-config_p.h"
-#endif
-
 #include <QtCore/QChar>
 #include <QtCore/QString>
 
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
-#   if !defined(TCHAR)
-#       define TCHAR wchar_t
-#   endif
-#else
-#   include <windows.h>
-#endif
+#include <CLucene/StdHeader.h>
 
 QT_BEGIN_HEADER
 
@@ -56,52 +46,6 @@
 #   define QHELP_EXPORT Q_DECL_IMPORT
 #endif
 
-//
-//  W A R N I N G
-//  -------------
-//
-// adjustments here, need to be done in 
-// QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
-//
-#if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
-
-#elif !defined(DISABLE_NAMESPACE)
-#   ifdef QT_NAMESPACE
-#       define CL_NS_DEF(sub) namespace QT_NAMESPACE { namespace lucene{ namespace sub{
-#       define CL_NS_DEF2(sub,sub2) namespace QT_NAMESPACE { namespace lucene{ namespace sub{ namespace sub2 {
-
-#       define CL_NS_END }}}
-#       define CL_NS_END2 }}}}
-
-#       define CL_NS_USE(sub) using namespace QT_NAMESPACE::lucene::sub;
-#       define CL_NS_USE2(sub,sub2) using namespace QT_NAMESPACE::lucene::sub::sub2;
-
-#       define CL_NS(sub) QT_NAMESPACE::lucene::sub
-#       define CL_NS2(sub,sub2) QT_NAMESPACE::lucene::sub::sub2
-#   else
-#       define CL_NS_DEF(sub) namespace lucene{ namespace sub{
-#       define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
-
-#       define CL_NS_END }}
-#       define CL_NS_END2 }}}
-
-#       define CL_NS_USE(sub) using namespace lucene::sub;
-#       define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
-
-#       define CL_NS(sub) lucene::sub
-#       define CL_NS2(sub,sub2) lucene::sub::sub2
-#   endif
-#else
-#   define CL_NS_DEF(sub)
-#   define CL_NS_DEF2(sub, sub2)
-#   define CL_NS_END
-#   define CL_NS_END2
-#   define CL_NS_USE(sub)
-#   define CL_NS_USE2(sub,sub2)
-#   define CL_NS(sub)
-#   define CL_NS2(sub,sub2)
-#endif
-
 namespace {
     TCHAR* QStringToTChar(const QString &str)
     {
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexreader.cpp qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexreader.cpp
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexreader.cpp	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexreader.cpp	2014-10-26 02:48:02.000000000 +0100
@@ -18,6 +18,8 @@
 #include "qindexreader_p.h"
 #include "qclucene_global_p.h"
 
+#include <QtCore/QDir>
+
 #include <CLucene.h>
 #include <CLucene/index/IndexReader.h>
 
@@ -59,13 +61,13 @@
 {
     using namespace lucene::index;
 
-    return IndexReader::isLuceneFile(filename);
+    return IndexReader::isLuceneFile(filename.toLocal8Bit().constData());
 }
 
 bool QCLuceneIndexReader::indexExists(const QString &directory)
 {
     using namespace lucene::index;
-    return IndexReader::indexExists(directory);
+    return IndexReader::indexExists(directory.toLocal8Bit().constData());
 }
 
 QCLuceneIndexReader QCLuceneIndexReader::open(const QString &path)
@@ -73,7 +75,7 @@
     using namespace lucene::index;
 
     QCLuceneIndexReader indexReader;
-    indexReader.d->reader = IndexReader::open(path);
+    indexReader.d->reader = IndexReader::open(path.toLocal8Bit().constData());
     
     return indexReader;
 }
@@ -81,25 +83,29 @@
 void QCLuceneIndexReader::unlock(const QString &path)
 {
     using namespace lucene::index;
-    IndexReader::unlock(path);
+    IndexReader::unlock(path.toLocal8Bit().constData());
 }
 
 bool QCLuceneIndexReader::isLocked(const QString &directory)
 {
+    // The system CLucene fails here if the directory does not exist yet, unlike
+    // the bundled one. Work around that.
+    QDir::current().mkpath(directory);
+
     using namespace lucene::index;
-    return IndexReader::isLocked(directory);
+    return IndexReader::isLocked(directory.toLocal8Bit().constData());
 }
 
 quint64 QCLuceneIndexReader::lastModified(const QString &directory)
 {
     using namespace lucene::index;
-    return quint64(IndexReader::lastModified(directory));
+    return quint64(IndexReader::lastModified(directory.toLocal8Bit().constData()));
 }
 
 qint64 QCLuceneIndexReader::getCurrentVersion(const QString &directory)
 {
     using namespace lucene::index;
-    return qint64(IndexReader::getCurrentVersion(directory));
+    return qint64(IndexReader::getCurrentVersion(directory.toLocal8Bit().constData()));
 }
 
 void QCLuceneIndexReader::close()
@@ -155,7 +161,7 @@
 void QCLuceneIndexReader::setNorm(qint32 doc, const QString &field, qreal value)
 {
     TCHAR *fieldName = QStringToTChar(field);
-    d->reader->setNorm(int32_t(doc), fieldName, qreal(value));
+    d->reader->setNorm(int32_t(doc), fieldName, (float_t)value);
     delete [] fieldName;
 }
 
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexwriter.cpp qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexwriter.cpp
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	2014-10-26 02:48:27.000000000 +0100
@@ -18,6 +18,8 @@
 #include "qindexwriter_p.h"
 #include "qindexreader_p.h"
 
+#include <QtCore/QDir>
+
 #include <CLucene.h>
 #include <CLucene/index/IndexWriter.h>
 
@@ -50,7 +52,12 @@
     : d(new QCLuceneIndexWriterPrivate())
     , analyzer(analyzer)
 {
-    d->writer = new lucene::index::IndexWriter(path, 
+    // The system CLucene cannot create directories recursively, so do it here.
+    // Ignore failure: If it failed, we will get an error from CLucene anyway.
+    if (create)
+        QDir::current().mkpath(path);
+
+    d->writer = new lucene::index::IndexWriter(path.toLocal8Bit().constData(), 
         analyzer.d->analyzer, create, closeDir);
 }
 
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qsearchable.cpp qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qsearchable.cpp
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qsearchable.cpp	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qsearchable.cpp	2014-10-26 02:48:44.000000000 +0100
@@ -95,7 +95,7 @@
     : QCLuceneSearcher()
 {
     lucene::search::IndexSearcher *searcher =
-        new lucene::search::IndexSearcher(path);
+        new lucene::search::IndexSearcher(path.toLocal8Bit().constData());
 
     reader.d->reader = searcher->getReader();
     reader.d->deleteCLuceneIndexReader = false;
diff -ur qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/lib.pro qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/lib.pro
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/lib.pro	2014-04-10 20:37:12.000000000 +0200
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/lib.pro	2014-10-26 02:27:55.000000000 +0100
@@ -43,6 +43,7 @@
     qhelp_global.cpp
 
 # access to clucene
+INCLUDEPATH += /usr/include/clucene09 $$[QT_INSTALL_LIBS]/clucene09 $$[QT_INSTALL_LIBS]
 SOURCES += qhelpsearchindexwriter_clucene.cpp \
     qhelpsearchindexreader_clucene.cpp
 HEADERS += qhelpenginecore.h \