summaryrefslogtreecommitdiffstats
path: root/external/clucene/patches
diff options
context:
space:
mode:
Diffstat (limited to 'external/clucene/patches')
-rw-r--r--external/clucene/patches/binary_function.patch57
-rw-r--r--external/clucene/patches/c++20.patch11
-rw-r--r--external/clucene/patches/clucene-asan.patch26
-rw-r--r--external/clucene/patches/clucene-debug.patch11
-rw-r--r--external/clucene/patches/clucene-git1-win64.patch45
-rw-r--r--external/clucene/patches/clucene-libcpp.patch42
-rw-r--r--external/clucene/patches/clucene-mixes-uptemplate-parameter-msvc-14.patch53
-rw-r--r--external/clucene/patches/clucene-multimap-put.patch9
-rw-r--r--external/clucene/patches/clucene-mutex.patch13
-rw-r--r--external/clucene/patches/clucene-narrowing-conversions.patch36
-rw-r--r--external/clucene/patches/clucene-nullptr.patch22
-rw-r--r--external/clucene/patches/clucene-pure-virtual.patch11
-rw-r--r--external/clucene/patches/clucene-reprobuild.patch.161
-rw-r--r--external/clucene/patches/clucene-ub.patch33
-rw-r--r--external/clucene/patches/clucene-warnings.patch124
-rw-r--r--external/clucene/patches/contribs-lib-makefile.patch23
-rw-r--r--external/clucene/patches/heap-buffer-overflow.patch11
-rw-r--r--external/clucene/patches/nullstring.patch11
-rw-r--r--external/clucene/patches/ostream-wchar_t.patch29
-rw-r--r--external/clucene/patches/write-strings.patch22
20 files changed, 650 insertions, 0 deletions
diff --git a/external/clucene/patches/binary_function.patch b/external/clucene/patches/binary_function.patch
new file mode 100644
index 0000000000..a7e4b867d0
--- /dev/null
+++ b/external/clucene/patches/binary_function.patch
@@ -0,0 +1,57 @@
+--- src/core/CLucene/search/BooleanQuery.cpp
++++ src/core/CLucene/search/BooleanQuery.cpp
+@@ -25,7 +25,7 @@
+ CL_NS_USE(util)
+ CL_NS_DEF(search)
+
+- class BooleanClause_Compare:public CL_NS_STD(binary_function)<const BooleanClause*,const BooleanClause*,bool>
++ class BooleanClause_Compare
+ {
+ public:
+ bool operator()( const BooleanClause* val1, const BooleanClause* val2 ) const {
+--- src/core/CLucene/util/_Arrays.h
++++ src/core/CLucene/util/_Arrays.h
+@@ -124,8 +124,7 @@
+
+ template <typename _kt, typename _comparator,
+ typename class1, typename class2>
+- class CLListEquals:
+- public CL_NS_STD(binary_function)<class1*,class2*,bool>
++ class CLListEquals
+ {
+ typedef typename class1::const_iterator _itr1;
+ typedef typename class2::const_iterator _itr2;
+--- src/core/CLucene/util/Equators.h
++++ src/core/CLucene/util/Equators.h
+@@ -22,19 +22,19 @@
+ /** @internal */
+ class CLUCENE_INLINE_EXPORT Equals{
+ public:
+- class CLUCENE_INLINE_EXPORT Int32:public CL_NS_STD(binary_function)<const int32_t*,const int32_t*,bool>
++ class CLUCENE_INLINE_EXPORT Int32
+ {
+ public:
+ bool operator()( const int32_t val1, const int32_t val2 ) const;
+ };
+
+- class CLUCENE_INLINE_EXPORT Char:public CL_NS_STD(binary_function)<const char*,const char*,bool>
++ class CLUCENE_INLINE_EXPORT Char
+ {
+ public:
+ bool operator()( const char* val1, const char* val2 ) const;
+ };
+ #ifdef _UCS2
+- class CLUCENE_INLINE_EXPORT WChar: public CL_NS_STD(binary_function)<const wchar_t*,const wchar_t*,bool>
++ class CLUCENE_INLINE_EXPORT WChar
+ {
+ public:
+ bool operator()( const wchar_t* val1, const wchar_t* val2 ) const;
+@@ -48,7 +48,7 @@
+
+
+ template<typename _cl>
+- class CLUCENE_INLINE_EXPORT Void:public CL_NS_STD(binary_function)<const void*,const void*,bool>
++ class CLUCENE_INLINE_EXPORT Void
+ {
+ public:
+ bool operator()( _cl* val1, _cl* val2 ) const{
diff --git a/external/clucene/patches/c++20.patch b/external/clucene/patches/c++20.patch
new file mode 100644
index 0000000000..c982e861e1
--- /dev/null
+++ b/external/clucene/patches/c++20.patch
@@ -0,0 +1,11 @@
+--- src/core/CLucene/util/_bufferedstream.h
++++ src/core/CLucene/util/_bufferedstream.h
+@@ -68,7 +68,7 @@
+ void setMinBufSize(int32_t s) {
+ buffer.makeSpace(s);
+ }
+- BufferedStreamImpl<T>();
++ BufferedStreamImpl();
+ public:
+ int32_t read(const T*& start, int32_t min, int32_t max);
+ int64_t reset(int64_t pos);
diff --git a/external/clucene/patches/clucene-asan.patch b/external/clucene/patches/clucene-asan.patch
new file mode 100644
index 0000000000..51adfad4ae
--- /dev/null
+++ b/external/clucene/patches/clucene-asan.patch
@@ -0,0 +1,26 @@
+--- src/core/CLucene/index/IndexWriter.cpp
++++ src/core/CLucene/index/IndexWriter.cpp
+@@ -53,7 +53,6 @@
+
+ DEFINE_MUTEX(IndexWriter::MESSAGE_ID_LOCK)
+ int32_t IndexWriter::MESSAGE_ID = 0;
+-const int32_t IndexWriter::MAX_TERM_LENGTH = DocumentsWriter::MAX_TERM_LENGTH;
+
+ class IndexWriter::Internal{
+ public:
+--- src/core/CLucene/index/IndexWriter.h
++++ src/core/CLucene/index/IndexWriter.h
+@@ -384,13 +384,6 @@
+ */
+ static const int32_t DEFAULT_MAX_MERGE_DOCS;
+
+- /**
+- * Absolute hard maximum length for a term. If a term
+- * arrives from the analyzer longer than this length, it
+- * is skipped and a message is printed to infoStream, if
+- * set (see {@link #setInfoStream}).
+- */
+- static const int32_t MAX_TERM_LENGTH;
+
+
+ /* Determines how often segment indices are merged by addDocument(). With
diff --git a/external/clucene/patches/clucene-debug.patch b/external/clucene/patches/clucene-debug.patch
new file mode 100644
index 0000000000..640454e2fb
--- /dev/null
+++ b/external/clucene/patches/clucene-debug.patch
@@ -0,0 +1,11 @@
+--- src/core/CLucene/index/TermInfosReader.cpp
++++ src/core/CLucene/index/TermInfosReader.cpp
+@@ -111,7 +111,7 @@
+ //destroy their elements
+ #ifdef _DEBUG
+ for ( int32_t i=0; i<indexTermsLength;++i ){
+- indexTerms[i].__cl_refcount--;
++ indexTerms[i].__cl_decref();
+ }
+ #endif
+ //Delete the arrays
diff --git a/external/clucene/patches/clucene-git1-win64.patch b/external/clucene/patches/clucene-git1-win64.patch
new file mode 100644
index 0000000000..dc07d380bb
--- /dev/null
+++ b/external/clucene/patches/clucene-git1-win64.patch
@@ -0,0 +1,45 @@
+--- src/shared/CLucene/config/threads.cpp 2013-06-06 16:25:23.014622397 +0200
++++ src/shared/CLucene/config/threads.cpp 2013-06-06 16:33:35.326048842 +0200
+@@ -63,14 +63,14 @@
+ }
+
+ int32_t mutex_thread::atomic_increment(_LUCENE_ATOMIC_INT *theInteger){
+-#ifdef _M_X64
++#ifdef _WIN64
+ return _InterlockedIncrement64(theInteger);
+ #else
+ return InterlockedIncrement(theInteger);
+ #endif
+ }
+ int32_t mutex_thread::atomic_decrement(_LUCENE_ATOMIC_INT *theInteger){
+-#ifdef _M_X64
++#ifdef _WIN64
+ return _InterlockedDecrement64(theInteger);
+ #else
+ return InterlockedDecrement(theInteger);
+--- src/shared/CLucene/config/_threads.h 2013-06-06 16:25:23.013622420 +0200
++++ src/shared/CLucene/config/_threads.h 2013-06-06 16:29:39.152601408 +0200
+@@ -34,9 +34,9 @@
+
+ __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
+
+-#ifdef _M_X64
+- __declspec(dllimport) long long __stdcall _InterlockedIncrement64(__inout long long volatile*);
+- __declspec(dllimport) long long __stdcall _InterlockedDecrement64(__inout long long volatile*);
++#ifdef _WIN64
++ long long __stdcall _InterlockedIncrement64(long long volatile*);
++ long long __stdcall _InterlockedDecrement64(long long volatile*);
+ #else
+ __declspec(dllimport) long __stdcall InterlockedIncrement(long volatile*);
+ __declspec(dllimport) long __stdcall InterlockedDecrement(long volatile*);
+--- src/shared/CLucene/LuceneThreads.h 2013-06-06 16:25:23.014622397 +0200
++++ src/shared/CLucene/LuceneThreads.h 2013-06-06 16:37:45.490166481 +0200
+@@ -101,7 +101,7 @@
+
+ #define _LUCENE_ATOMIC_INC(theInteger) CL_NS(util)::mutex_thread::atomic_increment(theInteger)
+ #define _LUCENE_ATOMIC_DEC(theInteger) CL_NS(util)::mutex_thread::atomic_decrement(theInteger)
+-#ifdef _M_X64
++#ifdef _WIN64
+ #define _LUCENE_ATOMIC_INT long long
+ #else
+ #define _LUCENE_ATOMIC_INT long
diff --git a/external/clucene/patches/clucene-libcpp.patch b/external/clucene/patches/clucene-libcpp.patch
new file mode 100644
index 0000000000..35235212c7
--- /dev/null
+++ b/external/clucene/patches/clucene-libcpp.patch
@@ -0,0 +1,42 @@
+--- src/shared/CLucene/LuceneThreads.h
++++ src/shared/CLucene/LuceneThreads.h
+@@ -7,6 +7,7 @@
+ #ifndef _LuceneThreads_h
+ #define _LuceneThreads_h
+
++#include "CLucene/config/_threads.h"
+
+ CL_NS_DEF(util)
+ class CLuceneThreadIdCompare;
+--- src/core/CLucene/util/VoidMap.h
++++ src/core/CLucene/util/VoidMap.h
+@@ -11,8 +11,13 @@
+ #include "CLucene/LuceneThreads.h"
+
+ #if defined(_CL_HAVE_TR1_UNORDERED_MAP) && defined(_CL_HAVE_TR1_UNORDERED_SET)
++#ifdef _LIBCPP_VERSION
++ #include <unordered_map>
++ #include <unordered_set>
++#else
+ #include <tr1/unordered_map>
+ #include <tr1/unordered_set>
++#endif
+ #elif defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
+ //hashing is all or nothing!
+ #include <hash_map>
+--- src/shared/CLucene/config/repl_tchar.h
++++ src/shared/CLucene/config/repl_tchar.h
+@@ -36,8 +36,13 @@
+ #define _tcsncpy wcsncpy //copy a specified amount of one string to another string.
+ #define _tcscat wcscat //copy a string onto the end of the other string
+ #define _tcsncat wcsncat
++#if defined(_LIBCPP_VERSION) && defined(__APPLE__)
++ #define _tcschr ::wcschr //find location of one character
++ #define _tcsstr ::wcsstr //find location of a string
++#else
+ #define _tcschr wcschr //find location of one character
+ #define _tcsstr wcsstr //find location of a string
++#endif
+ #define _tcslen wcslen //get length of a string
+ #define _tcscmp wcscmp //case sensitive compare two strings
+ #define _tcsncmp wcsncmp //case sensitive compare two strings
diff --git a/external/clucene/patches/clucene-mixes-uptemplate-parameter-msvc-14.patch b/external/clucene/patches/clucene-mixes-uptemplate-parameter-msvc-14.patch
new file mode 100644
index 0000000000..0c9cd0a1f5
--- /dev/null
+++ b/external/clucene/patches/clucene-mixes-uptemplate-parameter-msvc-14.patch
@@ -0,0 +1,53 @@
+diff -ru clucene.org/src/core/CLucene/util/VoidMap.h clucene/src/core/CLucene/util/VoidMap.h
+--- src/core/CLucene/util/VoidMap.h 2015-07-24 20:11:28.892997236 +0200
++++ src/core/CLucene/util/VoidMap.h 2015-07-24 20:21:17.290990623 +0200
+@@ -154,16 +154,16 @@
+
+ //a CLSet with CLHashMap traits
+ template<typename _kt, typename _vt,
+- typename _Compare,
++ typename Compare,
+ typename _EqualDummy,
+ typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
+ typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
+ class CLUCENE_INLINE_EXPORT CLHashMap:public __CLMap<_kt,_vt,
+- CL_NS_STD(map)<_kt,_vt, _Compare>,
++ CL_NS_STD(map)<_kt,_vt, Compare>,
+ _KeyDeletor,_ValueDeletor>
+ {
+- typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base;
+- typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>,
++ typedef typename CL_NS_STD(map)<_kt,_vt,Compare> _base;
++ typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, Compare>,
+ _KeyDeletor,_ValueDeletor> _this;
+ public:
+ CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
+@@ -260,15 +260,15 @@
+ //A collection that contains no duplicates
+ //does not guarantee that the order will remain constant over time
+ template<typename _kt, typename _vt,
+- typename _Compare,
++ typename Compare,
+ typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
+ typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
+ class CLUCENE_INLINE_EXPORT CLSet:public __CLMap<_kt,_vt,
+- CL_NS_STD(map)<_kt,_vt, _Compare>,
++ CL_NS_STD(map)<_kt,_vt, Compare>,
+ _KeyDeletor,_ValueDeletor>
+ {
+- typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base;
+- typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>,
++ typedef typename CL_NS_STD(map)<_kt,_vt,Compare> _base;
++ typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, Compare>,
+ _KeyDeletor,_ValueDeletor> _this;
+ public:
+ CLSet ( const bool deleteKey=false, const bool deleteValue=false )
+@@ -294,7 +294,7 @@
+
+ //A collection that can contains duplicates
+ template<typename _kt, typename _vt,
+- typename _Compare,
++ typename Compare,
+ typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
+ typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
+ class CLUCENE_INLINE_EXPORT CLMultiMap:public __CLMap<_kt,_vt,
diff --git a/external/clucene/patches/clucene-multimap-put.patch b/external/clucene/patches/clucene-multimap-put.patch
new file mode 100644
index 0000000000..bfff31a872
--- /dev/null
+++ b/external/clucene/patches/clucene-multimap-put.patch
@@ -0,0 +1,9 @@
+--- src/core/CLucene/util/VoidMap.h
++++ src/core/CLucene/util/VoidMap.h
+@@ -316,6 +316,7 @@ public:
+ if ( _this::dk || _this::dv )
+ _this::remove(k);
+
++ (*this)[k] = v;
+ }
+ };
diff --git a/external/clucene/patches/clucene-mutex.patch b/external/clucene/patches/clucene-mutex.patch
new file mode 100644
index 0000000000..2a6b7d2d36
--- /dev/null
+++ b/external/clucene/patches/clucene-mutex.patch
@@ -0,0 +1,13 @@
+--- src/core/CLucene/store/FSDirectory.cpp
++++ src/core/CLucene/store/FSDirectory.cpp
+@@ -219,9 +219,8 @@
+ _CLDECDELETE(handle);
+
+ //printf("handle=%d\n", handle->__cl_refcount);
+- if ( dounlock ){
+ mutex->unlock();
+- }else{
++ if ( !dounlock ){
+ delete mutex;
+ }
+ }
diff --git a/external/clucene/patches/clucene-narrowing-conversions.patch b/external/clucene/patches/clucene-narrowing-conversions.patch
new file mode 100644
index 0000000000..64065acb16
--- /dev/null
+++ b/external/clucene/patches/clucene-narrowing-conversions.patch
@@ -0,0 +1,36 @@
+--- src/core/CLucene/queryParser/QueryParser.cpp.sav 2011-03-17 01:21:07.000000000 +0100
++++ src/core/CLucene/queryParser/QueryParser.cpp 2012-03-09 18:20:58.000000000 +0100
+@@ -79,7 +79,7 @@
+ _T("<RANGEEX_GOOP>")
+ };
+
+-const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,0x80000000,0x20000000,0x80000000,0x10000,0x80000,0x10000,0x1f68000};
++const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,int32_t(0x80000000),0x20000000,int32_t(0x80000000),0x10000,0x80000,0x10000,0x1f68000};
+ const int32_t QueryParser::jj_la1_1[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0};
+
+ struct QueryParser::JJCalls {
+--- src/core/CLucene/queryParser/QueryParserTokenManager.cpp.sav 2011-03-17 01:21:07.000000000 +0100
++++ src/core/CLucene/queryParser/QueryParserTokenManager.cpp 2012-03-09 18:20:24.000000000 +0100
+@@ -15,9 +15,9 @@
+
+ CL_NS_DEF(queryParser)
+
+-const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)};
++const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))};
+ const int64_t QueryParserTokenManager::jjbitVec0[] = {
+- _ILONGLONG(0xfffffffffffffffe), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)
++ int64_t(_ILONGLONG(0xfffffffffffffffe)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))
+ };
+ const int32_t QueryParserTokenManager::jjnextStates[]={
+ 15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27,
+--- src/core/CLucene/queryParser/legacy/Lexer.cpp.sav 2013-03-01 09:25:18.000000000 +0100
++++ src/core/CLucene/queryParser/legacy/Lexer.cpp 09:25:12.000000000 +0100
+@@ -117,7 +117,7 @@ bool Lexer::GetNextToken(QueryToken* tok
+ if( _istspace(ch)!=0 ) {
+ continue;
+ }
+- TCHAR buf[2] = {ch,'\0'};
++ TCHAR buf[2] = {TCHAR(ch),'\0'};
+ switch(ch) {
+ case '+':
+ token->set(buf, QueryToken::PLUS);
diff --git a/external/clucene/patches/clucene-nullptr.patch b/external/clucene/patches/clucene-nullptr.patch
new file mode 100644
index 0000000000..a32ddb870b
--- /dev/null
+++ b/external/clucene/patches/clucene-nullptr.patch
@@ -0,0 +1,22 @@
+--- src/core/CLucene/index/DocumentsWriter.cpp 2011-03-16 20:21:07.000000000 -0400
++++ src/core/CLucene/index/DocumentsWriter.cpp 2012-07-31 18:52:09.000000000 -0400
+@@ -125,7 +125,7 @@
+ if (this->postingsFreeListDW.values){
+ if (this->postingsFreeCountDW < this->postingsFreeListDW.length) {
+ memset(this->postingsFreeListDW.values + this->postingsFreeCountDW
+- , NULL
++ , 0
+ , sizeof(Posting*));
+ }
+ postingsFreeListDW.deleteUntilNULL();
+--- src/core/CLucene/util/VoidMap.h 2012-07-31 18:13:08.000000000 -0400
++++ src/core/CLucene/util/VoidMap.h 2012-07-31 18:42:54.000000000 -0400
+@@ -83,7 +83,7 @@
+ _vt get( _kt k) const {
+ const_iterator itr = base::find(k);
+ if ( itr==base::end() )
+- return (_vt)NULL;
++ return static_cast<_vt>(0);
+ else
+ return itr->second;
+ }
diff --git a/external/clucene/patches/clucene-pure-virtual.patch b/external/clucene/patches/clucene-pure-virtual.patch
new file mode 100644
index 0000000000..0d4f95fe53
--- /dev/null
+++ b/external/clucene/patches/clucene-pure-virtual.patch
@@ -0,0 +1,11 @@
+--- src/core/CLucene/store/IndexOutput.h
++++ src/core/CLucene/store/IndexOutput.h
+@@ -159,7 +159,7 @@
+ * @param b the bytes to write
+ * @param len the number of bytes to write
+ */
+- virtual void flushBuffer(const uint8_t* b, const int32_t len) = 0;
++ virtual void flushBuffer(const uint8_t* /*b*/, const int32_t /*len*/) {}
+ };
+
+ CL_NS_END
diff --git a/external/clucene/patches/clucene-reprobuild.patch.1 b/external/clucene/patches/clucene-reprobuild.patch.1
new file mode 100644
index 0000000000..2c5a0b9513
--- /dev/null
+++ b/external/clucene/patches/clucene-reprobuild.patch.1
@@ -0,0 +1,61 @@
+diff -ur clucene.org/src/core/CLucene/index/IndexWriter.cpp clucene/src/core/CLucene/index/IndexWriter.cpp
+--- clucene.org/src/core/CLucene/index/IndexWriter.cpp 2023-11-02 17:31:00.110168174 +0100
++++ clucene/src/core/CLucene/index/IndexWriter.cpp 2023-11-02 17:33:22.507665912 +0100
+@@ -366,6 +366,10 @@
+ }
+ }
+
++void IndexWriter::setSegmentInfoStartVersion(int64_t startVersion) {
++ this->segmentInfos->setStartVersion(startVersion);
++}
++
+ int32_t IndexWriter::getMaxBufferedDocs() {
+ ensureOpen();
+ return docWriter->getMaxBufferedDocs();
+diff -ur clucene.org/src/core/CLucene/index/IndexWriter.h clucene/src/core/CLucene/index/IndexWriter.h
+--- clucene.org/src/core/CLucene/index/IndexWriter.h 2023-11-02 17:31:00.113501525 +0100
++++ clucene/src/core/CLucene/index/IndexWriter.h 2023-11-02 17:33:43.547787510 +0100
+@@ -336,6 +336,12 @@
+ int64_t getWriteLockTimeout();
+
+ /**
++ * Sets the 0th segmentinfo version. Default is current system time
++ * in milliseconds
++ */
++ void setSegmentInfoStartVersion(int64_t startVersion);
++
++ /**
+ * Sets the maximum time to wait for a commit lock (in milliseconds).
+ */
+ void setCommitLockTimeout(int64_t commitLockTimeout);
+diff -ur clucene.org/src/core/CLucene/index/SegmentInfos.cpp clucene/src/core/CLucene/index/SegmentInfos.cpp
+--- clucene.org/src/core/CLucene/index/SegmentInfos.cpp 2023-11-02 17:31:00.110168174 +0100
++++ clucene/src/core/CLucene/index/SegmentInfos.cpp 2023-11-02 18:04:43.855243418 +0100
+@@ -662,6 +662,10 @@
+ return IndexFileNames::fileNameFromGeneration( IndexFileNames::SEGMENTS, "", nextGeneration );
+ }
+
++ void SegmentInfos::setStartVersion(int64_t version) {
++ this->version = version;
++ }
++
+ void SegmentInfos::clearto(size_t from, size_t end){
+ size_t range = end - from;
+ if ( (infos.size() - from) >= range) { // Make sure we actually need to remove
+diff -ur clucene.org/src/core/CLucene/index/_SegmentInfos.h clucene/src/core/CLucene/index/_SegmentInfos.h
+--- clucene.org/src/core/CLucene/index/_SegmentInfos.h 2023-11-02 17:31:00.106834824 +0100
++++ clucene/src/core/CLucene/index/_SegmentInfos.h 2023-11-02 18:04:51.178598463 +0100
+@@ -347,6 +347,13 @@
+ */
+ std::string getNextSegmentFileName();
+
++ /**
++ * Set version value to start from
++
++ Defaults to current time in milliseconds
++ */
++ void setStartVersion(int64_t version);
++
+ /* public vector-like operations */
+ //delete and clears objects 'from' from to 'to'
+ void clearto(size_t to, size_t end);
diff --git a/external/clucene/patches/clucene-ub.patch b/external/clucene/patches/clucene-ub.patch
new file mode 100644
index 0000000000..e1ca3131f3
--- /dev/null
+++ b/external/clucene/patches/clucene-ub.patch
@@ -0,0 +1,33 @@
+--- src/core/CLucene/index/DocumentsWriterThreadState.cpp
++++ src/core/CLucene/index/DocumentsWriterThreadState.cpp
+@@ -994,7 +994,7 @@
+ const TCHAR* tokenText = token->termBuffer();
+ const int32_t tokenTextLen = token->termLength();
+
+- int32_t code = 0;
++ uint32_t code = 0;
+
+ // Compute hashcode
+ int32_t downto = tokenTextLen;
+@@ -1203,7 +1203,7 @@
+ const int32_t newMask = newSize-1;
+
+ ValueArray<Posting*> newHash(newSize);
+- int32_t hashPos, code;
++ int32_t hashPos; uint32_t code;
+ const TCHAR* pos = NULL;
+ const TCHAR* start = NULL;
+ Posting* p0;
+--- src/core/CLucene/store/IndexInput.cpp
++++ src/core/CLucene/store/IndexInput.cpp
+@@ -41,8 +41,8 @@
+ }
+
+ int64_t IndexInput::readLong() {
+- int64_t i = ((int64_t)readInt() << 32);
+- return (i | ((int64_t)readInt() & 0xFFFFFFFFL));
++ uint64_t i = ((uint64_t)readInt() << 32);
++ return (i | ((uint64_t)readInt() & 0xFFFFFFFFL));
+ }
+
+ int64_t IndexInput::readVLong() {
diff --git a/external/clucene/patches/clucene-warnings.patch b/external/clucene/patches/clucene-warnings.patch
new file mode 100644
index 0000000000..6326f6c35a
--- /dev/null
+++ b/external/clucene/patches/clucene-warnings.patch
@@ -0,0 +1,124 @@
+--- src/core/CLucene/analysis/AnalysisHeader.h 2012-02-22 12:37:22.531637934 +0000
++++ src/core/CLucene/analysis/AnalysisHeader.h 2012-02-22 12:39:15.369916728 +0000
+@@ -7,6 +7,11 @@
+ #ifndef _lucene_analysis_AnalysisHeader_
+ #define _lucene_analysis_AnalysisHeader_
+
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Woverloaded-virtual"
++#endif
++
+ #include "CLucene/index/Payload.h"
+ #include "CLucene/util/VoidList.h"
+ #include "CLucene/LuceneThreads.h"
+@@ -361,4 +361,8 @@
+ };
+
+ CL_NS_END
++
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic pop
++#endif
+ #endif
+--- src/core/CLucene/search/Searchable.h 2012-02-22 12:37:22.513637729 +0000
++++ src/core/CLucene/search/Searchable.h 2012-02-22 12:38:51.073641550 +0000
+@@ -7,6 +7,11 @@
+ #ifndef _lucene_search_Searcher_
+ #define _lucene_search_Searcher_
+
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Woverloaded-virtual"
++#endif
++
+
+ //#include "CLucene/index/IndexReader.h"
+ CL_CLASS_DEF(index,Term)
+@@ -180,4 +180,8 @@
+ };
+
+ CL_NS_END
++
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic pop
++#endif
+ #endif
+--- src/core/CLucene/store/IndexInput.h 2012-02-22 12:37:22.508637673 +0000
++++ src/core/CLucene/store/IndexInput.h 2012-02-22 12:39:00.465747935 +0000
+@@ -7,6 +7,11 @@
+ #ifndef _lucene_store_IndexInput_
+ #define _lucene_store_IndexInput_
+
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Woverloaded-virtual"
++#endif
++
+ #include "CLucene/LuceneThreads.h"
+ #include "CLucene/util/Equators.h"
+
+@@ -195,4 +195,8 @@
+ virtual void seekInternal(const int64_t pos) = 0;
+ };
+ CL_NS_END
++
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic pop
++#endif
+ #endif
+--- src/core/CLucene/util/Array.h 2012-02-22 12:37:22.510637696 +0000
++++ src/core/CLucene/util/Array.h 2012-02-22 12:38:33.714444884 +0000
+@@ -7,6 +7,20 @@
+ #ifndef _lucene_util_Array_
+ #define _lucene_util_Array_
+
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Wshadow"
++# pragma GCC diagnostic ignored "-Wunused-parameter"
++#if defined __clang__
++#if __has_warning("-Wmisleading-indentation")
++#pragma GCC diagnostic ignored "-Wmisleading-indentation"
++#endif
++#else
++# pragma GCC diagnostic ignored "-Wpragmas"
++# pragma GCC diagnostic ignored "-Wmisleading-indentation"
++#endif
++#endif
++
+ #include <stdlib.h>
+ #include <string.h>
+
+@@ -338,4 +338,8 @@
+
+
+ CL_NS_END
++
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic pop
++#endif
+ #endif
+--- src/core/CLucene/util/PriorityQueue.h 2012-02-22 12:37:22.510637696 +0000
++++ src/core/CLucene/util/PriorityQueue.h 2012-02-22 12:38:40.316519685 +0000
+@@ -7,6 +7,11 @@
+ #ifndef _lucene_util_PriorityQueue_
+ #define _lucene_util_PriorityQueue_
+
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic push
++# pragma GCC diagnostic ignored "-Wshadow"
++#endif
++
+ #include <stdlib.h>
+
+ CL_NS_DEF(util)
+@@ -199,4 +199,8 @@
+ };
+
+ CL_NS_END
++
++#if defined(__GNUC__) || defined __clang__
++# pragma GCC diagnostic pop
++#endif
+ #endif
diff --git a/external/clucene/patches/contribs-lib-makefile.patch b/external/clucene/patches/contribs-lib-makefile.patch
new file mode 100644
index 0000000000..8cc05aea4c
--- /dev/null
+++ b/external/clucene/patches/contribs-lib-makefile.patch
@@ -0,0 +1,23 @@
+--- src/contribs-lib/CMakeLists.txt 2012-05-24 22:38:20.002443317 +0200
++++ src/contribs-lib/CMakeLists.txt 2012-05-24 22:38:05.218443899 +0200
+@@ -113,3 +113,20 @@
+ COMPILE_DEFINITIONS_DEBUG _DEBUG
+ )
+
++#install lib
++install(TARGETS clucene-contribs-lib
++ DESTINATION ${LIB_DESTINATION}
++ COMPONENT runtime )
++
++#install public headers.
++FOREACH(file ${HEADERS})
++ get_filename_component(apath ${file} PATH)
++ get_filename_component(aname ${file} NAME)
++ file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
++ IF ( NOT aname MATCHES "^_.*" )
++ install(FILES ${file}
++ DESTINATION include/${relpath}
++ COMPONENT development)
++ ENDIF ( NOT aname MATCHES "^_.*" )
++ENDFOREACH(file)
++
diff --git a/external/clucene/patches/heap-buffer-overflow.patch b/external/clucene/patches/heap-buffer-overflow.patch
new file mode 100644
index 0000000000..7421db854c
--- /dev/null
+++ b/external/clucene/patches/heap-buffer-overflow.patch
@@ -0,0 +1,11 @@
+--- src/contribs-lib/CLucene/analysis/cjk/CJKAnalyzer.cpp
++++ src/contribs-lib/CLucene/analysis/cjk/CJKAnalyzer.cpp
+@@ -66,7 +66,7 @@
+ //ucs4(c variable). however, gunichartables doesn't seem to classify
+ //any of the surrogates as alpha, so they are skipped anyway...
+ //so for now we just convert to ucs4 so that we dont corrupt the input.
+- if ( c >= 0xd800 || c <= 0xdfff ){
++ if ( (c >= 0xd800 || c <= 0xdfff) && bufferIndex != dataLen ){
+ clunichar c2 = ioBuffer[bufferIndex];
+ if ( c2 >= 0xdc00 && c2 <= 0xdfff ){
+ bufferIndex++;
diff --git a/external/clucene/patches/nullstring.patch b/external/clucene/patches/nullstring.patch
new file mode 100644
index 0000000000..6043e9f008
--- /dev/null
+++ b/external/clucene/patches/nullstring.patch
@@ -0,0 +1,11 @@
+--- src/core/CLucene/index/SegmentInfos.cpp
++++ src/core/CLucene/index/SegmentInfos.cpp
+@@ -358,7 +358,7 @@
+ if (delGen == NO) {
+ // In this case we know there is no deletion filename
+ // against this segment
+- return NULL;
++ return {};
+ } else {
+ // If delGen is CHECK_DIR, it's the pre-lockless-commit file format
+ return IndexFileNames::fileNameFromGeneration(name.c_str(), (string(".") + IndexFileNames::DELETES_EXTENSION).c_str(), delGen);
diff --git a/external/clucene/patches/ostream-wchar_t.patch b/external/clucene/patches/ostream-wchar_t.patch
new file mode 100644
index 0000000000..63c9e14814
--- /dev/null
+++ b/external/clucene/patches/ostream-wchar_t.patch
@@ -0,0 +1,29 @@
+--- src/core/CLucene/index/DocumentsWriterThreadState.cpp
++++ src/core/CLucene/index/DocumentsWriterThreadState.cpp
+@@ -484,7 +484,7 @@
+ last->next = fp->next;
+
+ if (_parent->infoStream != NULL)
+- (*_parent->infoStream) << " remove field=" << fp->fieldInfo->name << "\n";
++ (*_parent->infoStream) << " remove field\n";
+
+ _CLDELETE(fp);
+ } else {
+@@ -557,7 +557,7 @@
+ fieldDataArray[i]->processField(analyzer);
+
+ if (maxTermPrefix != NULL && _parent->infoStream != NULL)
+- (*_parent->infoStream) << "WARNING: document contains at least one immense term (longer than the max length " << MAX_TERM_LENGTH << "), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '" << maxTermPrefix << "...'\n";
++ (*_parent->infoStream) << "WARNING: document contains at least one immense term (longer than the max length " << MAX_TERM_LENGTH << "), all of which were skipped. Please correct the analyzer to not produce such terms.\n";
+
+ if (_parent->ramBufferSize != IndexWriter::DISABLE_AUTO_FLUSH
+ && _parent->numBytesUsed > 0.95 * _parent->ramBufferSize)
+@@ -910,7 +910,7 @@
+ // truncate the token stream after maxFieldLength tokens.
+ if ( length >= maxFieldLength) {
+ if (_parent->infoStream != NULL)
+- (*_parent->infoStream) << "maxFieldLength " << maxFieldLength << " reached for field " << fieldInfo->name << ", ignoring following tokens\n";
++ (*_parent->infoStream) << "maxFieldLength " << maxFieldLength << " reached for field, ignoring following tokens\n";
+ break;
+ }
+ } else if (length > IndexWriter::DEFAULT_MAX_FIELD_LENGTH) {
diff --git a/external/clucene/patches/write-strings.patch b/external/clucene/patches/write-strings.patch
new file mode 100644
index 0000000000..d1661ee727
--- /dev/null
+++ b/external/clucene/patches/write-strings.patch
@@ -0,0 +1,22 @@
+--- src/contribs-lib/CLucene/analysis/PorterStemmer.cpp
++++ src/contribs-lib/CLucene/analysis/PorterStemmer.cpp
+@@ -94,7 +94,7 @@
+ return true;
+ }
+
+- bool PorterStemmer::ends(TCHAR *s) {
++ bool PorterStemmer::ends(const TCHAR *s) {
+ size_t l = _tcslen(s);
+ size_t o = k-l+1;
+ if (o < k0)
+--- src/contribs-lib/CLucene/analysis/PorterStemmer.h
++++ src/contribs-lib/CLucene/analysis/PorterStemmer.h
+@@ -68,7 +68,7 @@
+ */
+ bool cvc(size_t i);
+
+- bool ends(TCHAR *s);
++ bool ends(const TCHAR *s);
+
+ /* setto(s) sets (j+1),...k to the characters in the string s, readjusting
+ k. */