Blame SOURCES/qt-everywhere-opensource-src-4.8.6-system-clucene.patch

402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/fulltextsearch.pri	2014-04-10 20:37:12.000000000 +0200
402b94
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/fulltextsearch.pri	2014-10-26 03:33:45.000000000 +0100
402b94
@@ -1,125 +1,7 @@
402b94
-DEFINES += _BUILD_FOR_QT_ LUCENE_DISABLE_MEMTRACKING
402b94
-win32:DEFINES += _CRT_SECURE_NO_DEPRECATE _MT
402b94
-
402b94
-CLUCENEDIR = ../../../../src/3rdparty/clucene/src/CLucene
402b94
-
402b94
-INCLUDEPATH += . .. \
402b94
-               $$CLUCENEDIR \
402b94
-               $$CLUCENEDIR/../ \
402b94
-               $$CLUCENEDIR/analysis \
402b94
-               $$CLUCENEDIR/analysis/standard \
402b94
-               $$CLUCENEDIR/config \
402b94
-               $$CLUCENEDIR/debug \
402b94
-               $$CLUCENEDIR/document \
402b94
-               $$CLUCENEDIR/index \
402b94
-               $$CLUCENEDIR/queryParser \
402b94
-               $$CLUCENEDIR/search \
402b94
-               $$CLUCENEDIR/store \
402b94
-               $$CLUCENEDIR/util
402b94
-
402b94
-
402b94
-SOURCES += $$CLUCENEDIR/StdHeader.cpp \
402b94
-           $$CLUCENEDIR/analysis/AnalysisHeader.cpp \
402b94
-           $$CLUCENEDIR/analysis/Analyzers.cpp \
402b94
-           $$CLUCENEDIR/config/gunichartables.cpp \
402b94
-           $$CLUCENEDIR/config/repl_lltot.cpp \
402b94
-           $$CLUCENEDIR/config/repl_tcscasecmp.cpp \
402b94
-           $$CLUCENEDIR/config/repl_tcslwr.cpp \
402b94
-           $$CLUCENEDIR/config/repl_tcstod.cpp \
402b94
-           $$CLUCENEDIR/config/repl_tcstoll.cpp \
402b94
-           $$CLUCENEDIR/config/repl_tprintf.cpp \
402b94
-           $$CLUCENEDIR/config/threads.cpp \
402b94
-           $$CLUCENEDIR/config/utf8.cpp \
402b94
-           $$CLUCENEDIR/debug/condition.cpp \
402b94
-           $$CLUCENEDIR/debug/error.cpp \
402b94
-           $$CLUCENEDIR/debug/memtracking.cpp \
402b94
-           $$CLUCENEDIR/document/DateField.cpp \
402b94
-           $$CLUCENEDIR/document/Document.cpp \
402b94
-           $$CLUCENEDIR/document/Field.cpp \
402b94
-           $$CLUCENEDIR/index/CompoundFile.cpp \
402b94
-           $$CLUCENEDIR/index/DocumentWriter.cpp \
402b94
-           $$CLUCENEDIR/index/FieldInfos.cpp \
402b94
-           $$CLUCENEDIR/index/FieldsReader.cpp \
402b94
-           $$CLUCENEDIR/index/FieldsWriter.cpp \
402b94
-           $$CLUCENEDIR/index/IndexModifier.cpp \
402b94
-           $$CLUCENEDIR/index/IndexReader.cpp \
402b94
-           $$CLUCENEDIR/index/IndexWriter.cpp \
402b94
-           $$CLUCENEDIR/index/MultiReader.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentInfos.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentMergeInfo.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentMergeQueue.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentMerger.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentReader.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentTermDocs.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentTermEnum.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentTermPositions.cpp \
402b94
-           $$CLUCENEDIR/index/SegmentTermVector.cpp \
402b94
-           $$CLUCENEDIR/index/Term.cpp \
402b94
-           $$CLUCENEDIR/index/TermInfo.cpp \
402b94
-           $$CLUCENEDIR/index/TermInfosReader.cpp \
402b94
-           $$CLUCENEDIR/index/TermInfosWriter.cpp \
402b94
-           $$CLUCENEDIR/index/TermVectorReader.cpp \
402b94
-           $$CLUCENEDIR/index/TermVectorWriter.cpp \
402b94
-           $$CLUCENEDIR/queryParser/Lexer.cpp \
402b94
-           $$CLUCENEDIR/queryParser/MultiFieldQueryParser.cpp \
402b94
-           $$CLUCENEDIR/queryParser/QueryParser.cpp \
402b94
-           $$CLUCENEDIR/queryParser/QueryParserBase.cpp \
402b94
-           $$CLUCENEDIR/queryParser/QueryToken.cpp \
402b94
-           $$CLUCENEDIR/queryParser/TokenList.cpp \
402b94
-           $$CLUCENEDIR/search/BooleanQuery.cpp \
402b94
-           $$CLUCENEDIR/search/BooleanScorer.cpp \
402b94
-           $$CLUCENEDIR/search/CachingWrapperFilter.cpp \
402b94
-           $$CLUCENEDIR/search/ChainedFilter.cpp \
402b94
-           $$CLUCENEDIR/search/ConjunctionScorer.cpp \
402b94
-           $$CLUCENEDIR/search/DateFilter.cpp \
402b94
-           $$CLUCENEDIR/search/ExactPhraseScorer.cpp \
402b94
-           $$CLUCENEDIR/search/Explanation.cpp \
402b94
-           $$CLUCENEDIR/search/FieldCache.cpp \
402b94
-           $$CLUCENEDIR/search/FieldCacheImpl.cpp \
402b94
-           $$CLUCENEDIR/search/FieldDocSortedHitQueue.cpp \
402b94
-           $$CLUCENEDIR/search/FieldSortedHitQueue.cpp \
402b94
-           $$CLUCENEDIR/search/FilteredTermEnum.cpp \
402b94
-           $$CLUCENEDIR/search/FuzzyQuery.cpp \
402b94
-           $$CLUCENEDIR/search/HitQueue.cpp \
402b94
-           $$CLUCENEDIR/search/Hits.cpp \
402b94
-           $$CLUCENEDIR/search/IndexSearcher.cpp \
402b94
-           $$CLUCENEDIR/search/MultiSearcher.cpp \
402b94
-           $$CLUCENEDIR/search/MultiTermQuery.cpp \
402b94
-           $$CLUCENEDIR/search/PhrasePositions.cpp \
402b94
-           $$CLUCENEDIR/search/PhraseQuery.cpp \
402b94
-           $$CLUCENEDIR/search/PhraseScorer.cpp \
402b94
-           $$CLUCENEDIR/search/PrefixQuery.cpp \
402b94
-           $$CLUCENEDIR/search/QueryFilter.cpp \
402b94
-           $$CLUCENEDIR/search/RangeFilter.cpp \
402b94
-           $$CLUCENEDIR/search/RangeQuery.cpp \
402b94
-           $$CLUCENEDIR/search/SearchHeader.cpp \
402b94
-           $$CLUCENEDIR/search/Similarity.cpp \
402b94
-           $$CLUCENEDIR/search/SloppyPhraseScorer.cpp \
402b94
-           $$CLUCENEDIR/search/Sort.cpp \
402b94
-           $$CLUCENEDIR/search/TermQuery.cpp \
402b94
-           $$CLUCENEDIR/search/TermScorer.cpp \
402b94
-           $$CLUCENEDIR/search/WildcardQuery.cpp \
402b94
-           $$CLUCENEDIR/search/WildcardTermEnum.cpp \
402b94
-           $$CLUCENEDIR/store/FSDirectory.cpp \
402b94
-           $$CLUCENEDIR/store/IndexInput.cpp \
402b94
-           $$CLUCENEDIR/store/IndexOutput.cpp \
402b94
-           $$CLUCENEDIR/store/Lock.cpp \
402b94
-           $$CLUCENEDIR/store/MMapInput.cpp \
402b94
-           $$CLUCENEDIR/store/RAMDirectory.cpp \
402b94
-           $$CLUCENEDIR/store/TransactionalRAMDirectory.cpp \
402b94
-           $$CLUCENEDIR/util/BitSet.cpp \
402b94
-           $$CLUCENEDIR/util/Equators.cpp \
402b94
-           $$CLUCENEDIR/util/FastCharStream.cpp \
402b94
-           $$CLUCENEDIR/util/fileinputstream.cpp \
402b94
-           $$CLUCENEDIR/util/Misc.cpp \
402b94
-           $$CLUCENEDIR/util/Reader.cpp \
402b94
-           $$CLUCENEDIR/util/StringBuffer.cpp \
402b94
-           $$CLUCENEDIR/util/StringIntern.cpp \
402b94
-           $$CLUCENEDIR/util/ThreadLocal.cpp \
402b94
-           $$CLUCENEDIR/analysis/standard/StandardAnalyzer.cpp \
402b94
-           $$CLUCENEDIR/analysis/standard/StandardFilter.cpp \
402b94
-           $$CLUCENEDIR/analysis/standard/StandardTokenizer.cpp
402b94
 
402b94
+INCLUDEPATH += /usr/include/clucene09 $$[QT_INSTALL_LIBS]/clucene09 $$[QT_INSTALL_LIBS]
402b94
+LIBS += -L$$[QT_INSTALL_LIBS]/clucene09 -lclucene
402b94
+#DEFINES += LUCENE_ENABLE_REFCOUNT (must be set at CLucene build time!)
402b94
 
402b94
 #Header files
402b94
 HEADERS += qclucene_global_p.h \
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene-config_p.h	2014-04-10 20:37:12.000000000 +0200
402b94
+++ 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
402b94
@@ -15,6 +15,8 @@
402b94
 **
402b94
 ****************************************************************************/
402b94
 
402b94
+#error This header must not be included when building against system CLucene.
402b94
+
402b94
 #ifndef QCLUCENE_CONFIG_P_H
402b94
 #define QCLUCENE_CONFIG_P_H
402b94
 
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qclucene_global_p.h	2014-04-10 20:37:12.000000000 +0200
402b94
+++ 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
402b94
@@ -29,20 +29,10 @@
402b94
 // We mean it.
402b94
 //
402b94
 
402b94
-#if !defined(_MSC_VER)
402b94
-#   include "qclucene-config_p.h"
402b94
-#endif
402b94
-
402b94
 #include <QtCore/QChar>
402b94
 #include <QtCore/QString>
402b94
 
402b94
-#if !defined(_MSC_VER) && !defined(__MINGW32__) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
402b94
-#   if !defined(TCHAR)
402b94
-#       define TCHAR wchar_t
402b94
-#   endif
402b94
-#else
402b94
-#   include <windows.h>
402b94
-#endif
402b94
+#include <CLucene/StdHeader.h>
402b94
 
402b94
 QT_BEGIN_HEADER
402b94
 
402b94
@@ -56,52 +46,6 @@
402b94
 #   define QHELP_EXPORT Q_DECL_IMPORT
402b94
 #endif
402b94
 
402b94
-//
402b94
-//  W A R N I N G
402b94
-//  -------------
402b94
-//
402b94
-// adjustments here, need to be done in 
402b94
-// QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
402b94
-//
402b94
-#if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
402b94
-
402b94
-#elif !defined(DISABLE_NAMESPACE)
402b94
-#   ifdef QT_NAMESPACE
402b94
-#       define CL_NS_DEF(sub) namespace QT_NAMESPACE { namespace lucene{ namespace sub{
402b94
-#       define CL_NS_DEF2(sub,sub2) namespace QT_NAMESPACE { namespace lucene{ namespace sub{ namespace sub2 {
402b94
-
402b94
-#       define CL_NS_END }}}
402b94
-#       define CL_NS_END2 }}}}
402b94
-
402b94
-#       define CL_NS_USE(sub) using namespace QT_NAMESPACE::lucene::sub;
402b94
-#       define CL_NS_USE2(sub,sub2) using namespace QT_NAMESPACE::lucene::sub::sub2;
402b94
-
402b94
-#       define CL_NS(sub) QT_NAMESPACE::lucene::sub
402b94
-#       define CL_NS2(sub,sub2) QT_NAMESPACE::lucene::sub::sub2
402b94
-#   else
402b94
-#       define CL_NS_DEF(sub) namespace lucene{ namespace sub{
402b94
-#       define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
402b94
-
402b94
-#       define CL_NS_END }}
402b94
-#       define CL_NS_END2 }}}
402b94
-
402b94
-#       define CL_NS_USE(sub) using namespace lucene::sub;
402b94
-#       define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
402b94
-
402b94
-#       define CL_NS(sub) lucene::sub
402b94
-#       define CL_NS2(sub,sub2) lucene::sub::sub2
402b94
-#   endif
402b94
-#else
402b94
-#   define CL_NS_DEF(sub)
402b94
-#   define CL_NS_DEF2(sub, sub2)
402b94
-#   define CL_NS_END
402b94
-#   define CL_NS_END2
402b94
-#   define CL_NS_USE(sub)
402b94
-#   define CL_NS_USE2(sub,sub2)
402b94
-#   define CL_NS(sub)
402b94
-#   define CL_NS2(sub,sub2)
402b94
-#endif
402b94
-
402b94
 namespace {
402b94
     TCHAR* QStringToTChar(const QString &str)
402b94
     {
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexreader.cpp	2014-04-10 20:37:12.000000000 +0200
402b94
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexreader.cpp	2014-10-26 02:48:02.000000000 +0100
402b94
@@ -18,6 +18,8 @@
402b94
 #include "qindexreader_p.h"
402b94
 #include "qclucene_global_p.h"
402b94
 
402b94
+#include <QtCore/QDir>
402b94
+
402b94
 #include <CLucene.h>
402b94
 #include <CLucene/index/IndexReader.h>
402b94
 
402b94
@@ -59,13 +61,13 @@
402b94
 {
402b94
     using namespace lucene::index;
402b94
 
402b94
-    return IndexReader::isLuceneFile(filename);
402b94
+    return IndexReader::isLuceneFile(filename.toLocal8Bit().constData());
402b94
 }
402b94
 
402b94
 bool QCLuceneIndexReader::indexExists(const QString &directory)
402b94
 {
402b94
     using namespace lucene::index;
402b94
-    return IndexReader::indexExists(directory);
402b94
+    return IndexReader::indexExists(directory.toLocal8Bit().constData());
402b94
 }
402b94
 
402b94
 QCLuceneIndexReader QCLuceneIndexReader::open(const QString &path)
402b94
@@ -73,7 +75,7 @@
402b94
     using namespace lucene::index;
402b94
 
402b94
     QCLuceneIndexReader indexReader;
402b94
-    indexReader.d->reader = IndexReader::open(path);
402b94
+    indexReader.d->reader = IndexReader::open(path.toLocal8Bit().constData());
402b94
     
402b94
     return indexReader;
402b94
 }
402b94
@@ -81,25 +83,29 @@
402b94
 void QCLuceneIndexReader::unlock(const QString &path)
402b94
 {
402b94
     using namespace lucene::index;
402b94
-    IndexReader::unlock(path);
402b94
+    IndexReader::unlock(path.toLocal8Bit().constData());
402b94
 }
402b94
 
402b94
 bool QCLuceneIndexReader::isLocked(const QString &directory)
402b94
 {
402b94
+    // The system CLucene fails here if the directory does not exist yet, unlike
402b94
+    // the bundled one. Work around that.
402b94
+    QDir::current().mkpath(directory);
402b94
+
402b94
     using namespace lucene::index;
402b94
-    return IndexReader::isLocked(directory);
402b94
+    return IndexReader::isLocked(directory.toLocal8Bit().constData());
402b94
 }
402b94
 
402b94
 quint64 QCLuceneIndexReader::lastModified(const QString &directory)
402b94
 {
402b94
     using namespace lucene::index;
402b94
-    return quint64(IndexReader::lastModified(directory));
402b94
+    return quint64(IndexReader::lastModified(directory.toLocal8Bit().constData()));
402b94
 }
402b94
 
402b94
 qint64 QCLuceneIndexReader::getCurrentVersion(const QString &directory)
402b94
 {
402b94
     using namespace lucene::index;
402b94
-    return qint64(IndexReader::getCurrentVersion(directory));
402b94
+    return qint64(IndexReader::getCurrentVersion(directory.toLocal8Bit().constData()));
402b94
 }
402b94
 
402b94
 void QCLuceneIndexReader::close()
402b94
@@ -155,7 +161,7 @@
402b94
 void QCLuceneIndexReader::setNorm(qint32 doc, const QString &field, qreal value)
402b94
 {
402b94
     TCHAR *fieldName = QStringToTChar(field);
402b94
-    d->reader->setNorm(int32_t(doc), fieldName, qreal(value));
402b94
+    d->reader->setNorm(int32_t(doc), fieldName, (float_t)value);
402b94
     delete [] fieldName;
402b94
 }
402b94
 
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	2014-04-10 20:37:12.000000000 +0200
402b94
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qindexwriter.cpp	2014-10-26 02:48:27.000000000 +0100
402b94
@@ -18,6 +18,8 @@
402b94
 #include "qindexwriter_p.h"
402b94
 #include "qindexreader_p.h"
402b94
 
402b94
+#include <QtCore/QDir>
402b94
+
402b94
 #include <CLucene.h>
402b94
 #include <CLucene/index/IndexWriter.h>
402b94
 
402b94
@@ -50,7 +52,12 @@
402b94
     : d(new QCLuceneIndexWriterPrivate())
402b94
     , analyzer(analyzer)
402b94
 {
402b94
-    d->writer = new lucene::index::IndexWriter(path, 
402b94
+    // The system CLucene cannot create directories recursively, so do it here.
402b94
+    // Ignore failure: If it failed, we will get an error from CLucene anyway.
402b94
+    if (create)
402b94
+        QDir::current().mkpath(path);
402b94
+
402b94
+    d->writer = new lucene::index::IndexWriter(path.toLocal8Bit().constData(), 
402b94
         analyzer.d->analyzer, create, closeDir);
402b94
 }
402b94
 
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/fulltextsearch/qsearchable.cpp	2014-04-10 20:37:12.000000000 +0200
402b94
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/fulltextsearch/qsearchable.cpp	2014-10-26 02:48:44.000000000 +0100
402b94
@@ -95,7 +95,7 @@
402b94
     : QCLuceneSearcher()
402b94
 {
402b94
     lucene::search::IndexSearcher *searcher =
402b94
-        new lucene::search::IndexSearcher(path);
402b94
+        new lucene::search::IndexSearcher(path.toLocal8Bit().constData());
402b94
 
402b94
     reader.d->reader = searcher->getReader();
402b94
     reader.d->deleteCLuceneIndexReader = false;
402b94
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
402b94
--- qt-everywhere-opensource-src-4.8.6/tools/assistant/lib/lib.pro	2014-04-10 20:37:12.000000000 +0200
402b94
+++ qt-everywhere-opensource-src-4.8.6-system-clucene/tools/assistant/lib/lib.pro	2014-10-26 02:27:55.000000000 +0100
402b94
@@ -43,6 +43,7 @@
402b94
     qhelp_global.cpp
402b94
 
402b94
 # access to clucene
402b94
+INCLUDEPATH += /usr/include/clucene09 $$[QT_INSTALL_LIBS]/clucene09 $$[QT_INSTALL_LIBS]
402b94
 SOURCES += qhelpsearchindexwriter_clucene.cpp \
402b94
     qhelpsearchindexreader_clucene.cpp
402b94
 HEADERS += qhelpenginecore.h \