SHA256
8
0
forked from pool/lucene__
Files
lucene__/lucene++-3.0.9-fix-linking-DefaultSimilarity.patch

130 lines
27 KiB
Diff
Raw Permalink Normal View History

From 57fc3923f6ec0d569142b83d2d9332e2c0926d2a Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Sat, 24 Feb 2024 21:26:58 +0100
Subject: [PATCH] Update DefaultSimilarity.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes a linker failure when building tests (lto related?)
https://launchpadlibrarian.net/715939877/buildlog_ubuntu-noble-amd64.lucene++_3.0.9-1_BUILDING.txt.gz
/usr/bin/c++ -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/lucene++-3.0.9-1 -Wdate-time -D_FORTIFY_SOURCE=3 -O2 -g -DNDEBUG -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro "CMakeFiles/lucene++-tester.dir/analysis/AnalyzersTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/BaseTokenStreamFixture.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/CachingTokenFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/CharFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/KeywordAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/LengthFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/MappingCharFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/NumericTokenStreamTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/PerFieldAnalzyerWrapperTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/StopAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/StopFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/TeeSinkTokenFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/TokenTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/standard/StandardAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/tokenattributes/SimpleAttributeTest.cpp.o" "CMakeFiles/lucene++-tester.dir/analysis/tokenattributes/TermAttributeTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/ar/ArabicAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/ar/ArabicNormalizationFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/ar/ArabicStemFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/br/BrazilianStemmerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/cjk/CJKTokenizerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/cn/ChineseTokenizerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/cz/CzechAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/de/GermanStemFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/el/GreekAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/fa/PersianAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/fa/PersianNormalizationFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/fr/ElisionTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/fr/FrenchAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/nl/DutchStemmerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/reverse/ReverseStringFilterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/ru/RussianAnalyzerTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/analyzers/common/analysis/ru/RussianStemTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/highlighter/HighlighterTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/memory/MemoryIndexTest.cpp.o" "CMakeFiles/lucene++-tester.dir/contrib/snowball/SnowballTest.cpp.o" "CMakeFiles/lucene++-tester.dir/document/BinaryDocumentTest.cpp.o" "CMakeFiles/lucene++-tester.dir/document/DateFieldTest.cpp.o" "CMakeFiles/lucene++-tester.dir/document/DateToolsTest.cpp.o" "CMakeFiles/lucene++-tester.dir/document/DocumentTest.cpp.o" "CMakeFiles/lucene++-tester.dir/document/NumberToolsTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/AddIndexesNoOptimizeTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/AtomicUpdateTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/BackwardsCompatibilityTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/ByteSlicesTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/CheckIndexTest.cpp.o" "CMakeFiles/lucene++-tester.dir/index/CompoundFileTest.cpp.o" "CM
/usr/src/lucene++-3.0.9-1/src/test/index/AtomicUpdateTest.cpp:27:7: warning: type struct MockIndexWriter violates the C++ One Definition Rule [-Wodr]
/usr/src/lucene++-3.0.9-1/src/test/index/IndexWriterExceptionsTest.cpp:122:7: note: a different type is defined in another translation unit
/usr/src/lucene++-3.0.9-1/src/test/index/AtomicUpdateTest.cpp:37:15: note: the first difference of corresponding definitions is field random
/usr/src/lucene++-3.0.9-1/src/test/index/IndexWriterExceptionsTest.cpp:132:15: note: a field with different name is defined in another translation unit
/usr/src/lucene++-3.0.9-1/src/test/store/IndexOutputTest.cpp:118:7: warning: type struct SourceIndexInput violates the C++ One Definition Rule [-Wodr]
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:100:7: note: a type with the same name but different base type is defined in another translation unit
/usr/src/lucene++-3.0.9-1/include/lucene++/IndexInput.h:17:14: note: type name Lucene::IndexInput should match type name Lucene::BufferedIndexInput
/usr/src/lucene++-3.0.9-1/include/lucene++/BufferedIndexInput.h:15:14: note: the incompatible type is defined here
/usr/src/lucene++-3.0.9-1/src/test/store/IndexOutputTest.cpp:146:27: warning: type of clone does not match original declaration [-Wlto-type-mismatch]
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:117:27: note: clone was previously declared here
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:117:27: note: code may be misoptimized unless -fno-strict-aliasing is used
/usr/src/lucene++-3.0.9-1/src/test/store/IndexOutputTest.cpp:142:21: warning: type of length does not match original declaration [-Wlto-type-mismatch]
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:113:21: note: length was previously declared here
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:113:21: note: code may be misoptimized unless -fno-strict-aliasing is used
/usr/src/lucene++-3.0.9-1/src/test/search/ScorerPerfTest.cpp:27:7: warning: virtual table of type struct CountingHitCollector violates one definition rule [-Wodr]
/usr/src/lucene++-3.0.9-1/src/test/index/OmitTfTest.cpp:88:7: note: the conflicting type defined in another translation unit
/usr/src/lucene++-3.0.9-1/src/test/index/OmitTfTest.cpp:99:5: note: virtual method getClassName
/usr/src/lucene++-3.0.9-1/include/lucene++/Collector.h:103:5: note: ought to match virtual method getClassName but does not
/usr/src/lucene++-3.0.9-1/src/test/index/IndexReaderCloneNormsTest.cpp:25:7: warning: virtual table of type struct SimilarityOne violates one definition rule [-Wodr]
/usr/src/lucene++-3.0.9-1/src/test/index/IndexReaderCloneNormsTest.cpp:25:7: note: the conflicting type defined in another translation unit
/usr/src/lucene++-3.0.9-1/include/lucene++/DefaultSimilarity.h:20:5: note: virtual method getClassName
/usr/src/lucene++-3.0.9-1/src/test/index/NormsTest.cpp:26:5: note: ought to match virtual method getClassName but does not
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:100:7: warning: type struct SourceIndexInput violates the C++ One Definition Rule [-Wodr]
/usr/src/lucene++-3.0.9-1/src/test/store/BufferedIndexOutputTest.cpp:100:7: note: a type with the same name but different base type is defined in another translation unit
/usr/src/lucene++-3.0.9-1/include/lucene++/IndexInput.h:17:14: note: type name Lucene::IndexInput should match type name Lucene::BufferedIndexInput
/usr/src/lucene++-3.0.9-1/include/lucene++/BufferedIndexInput.h:15:14: note: the incompatible type is defined here
/usr/bin/ld: /tmp/ccUJivoA.ltrans35.ltrans.o:(.data.rel.ro+0x558): undefined reference to `Lucene::DefaultSimilarity::queryNorm(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans35.ltrans.o:(.data.rel.ro+0x568): undefined reference to `Lucene::DefaultSimilarity::sloppyFreq(int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans35.ltrans.o:(.data.rel.ro+0x570): undefined reference to `Lucene::DefaultSimilarity::tf(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans35.ltrans.o:(.data.rel.ro+0x588): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans35.ltrans.o:(.data.rel.ro+0x590): undefined reference to `Lucene::DefaultSimilarity::coord(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans72.ltrans.o:(.data.rel.ro+0x360): undefined reference to `Lucene::DefaultSimilarity::lengthNorm(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans72.ltrans.o:(.data.rel.ro+0x368): undefined reference to `Lucene::DefaultSimilarity::queryNorm(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans72.ltrans.o:(.data.rel.ro+0x378): undefined reference to `Lucene::DefaultSimilarity::sloppyFreq(int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans72.ltrans.o:(.data.rel.ro+0x380): undefined reference to `Lucene::DefaultSimilarity::tf(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans72.ltrans.o:(.data.rel.ro+0x398): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans75.ltrans.o:(.data.rel.ro+0x328): undefined reference to `Lucene::DefaultSimilarity::lengthNorm(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans75.ltrans.o:(.data.rel.ro+0x340): undefined reference to `Lucene::DefaultSimilarity::sloppyFreq(int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans75.ltrans.o:(.data.rel.ro+0x348): undefined reference to `Lucene::DefaultSimilarity::tf(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans75.ltrans.o:(.data.rel.ro+0x360): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans75.ltrans.o:(.data.rel.ro+0x368): undefined reference to `Lucene::DefaultSimilarity::coord(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans78.ltrans.o:(.data.rel.ro+0x1d0): undefined reference to `Lucene::DefaultSimilarity::queryNorm(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans78.ltrans.o:(.data.rel.ro+0x1e0): undefined reference to `Lucene::DefaultSimilarity::sloppyFreq(int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans78.ltrans.o:(.data.rel.ro+0x208): undefined reference to `Lucene::DefaultSimilarity::coord(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans106.ltrans.o:(.data.rel.ro+0x758): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4b8): undefined reference to `Lucene::DefaultSimilarity::lengthNorm(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4c0): undefined reference to `Lucene::DefaultSimilarity::queryNorm(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4d0): undefined reference to `Lucene::DefaultSimilarity::sloppyFreq(int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4d8): undefined reference to `Lucene::DefaultSimilarity::tf(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4f0): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans109.ltrans.o:(.data.rel.ro+0x4f8): undefined reference to `Lucene::DefaultSimilarity::coord(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans114.ltrans.o:(.data.rel.ro+0x320): undefined reference to `Lucene::DefaultSimilarity::lengthNorm(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans114.ltrans.o:(.data.rel.ro+0x328): undefined reference to `Lucene::DefaultSimilarity::queryNorm(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans114.ltrans.o:(.data.rel.ro+0x340): undefined reference to `Lucene::DefaultSimilarity::tf(double)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans114.ltrans.o:(.data.rel.ro+0x358): undefined reference to `Lucene::DefaultSimilarity::idf(int, int)'
/usr/bin/ld: /tmp/ccUJivoA.ltrans114.ltrans.o:(.data.rel.ro+0x360): undefined reference to `Lucene::DefaultSimilarity::coord(int, int)'
collect2: error: ld returned 1 exit status
make[4]: *** [src/test/CMakeFiles/lucene++-tester.dir/build.make:3876: src/test/lucene++-tester] Error 1
make[4]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[3]: *** [CMakeFiles/Makefile2:805: src/test/CMakeFiles/lucene++-tester.dir/all] Error 2
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[2]: *** [Makefile:139: all] Error 2
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
dh_auto_build: error: cd obj-x86_64-linux-gnu && make -j4 "INSTALL=install --strip-program=true" VERBOSE=1 returned exit code 2
make[1]: *** [debian/rules:14: override_dh_auto_build-indep] Error 25
---
src/core/search/DefaultSimilarity.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/core/search/DefaultSimilarity.cpp b/src/core/search/DefaultSimilarity.cpp
index c98f2d95..da4c3db2 100644
--- a/src/core/search/DefaultSimilarity.cpp
+++ b/src/core/search/DefaultSimilarity.cpp
@@ -27,35 +27,35 @@ double DefaultSimilarity::computeNorm(const String& fieldName, const FieldInvert
return (state->getBoost() * lengthNorm(fieldName, numTerms));
}
-inline double DefaultSimilarity::lengthNorm(const String& fieldName, int32_t numTokens) {
+double DefaultSimilarity::lengthNorm(const String& fieldName, int32_t numTokens) {
return (double)(1.0 / std::sqrt((double)numTokens));
}
-inline double DefaultSimilarity::queryNorm(double sumOfSquaredWeights) {
+double DefaultSimilarity::queryNorm(double sumOfSquaredWeights) {
return (double)(1.0 / std::sqrt(sumOfSquaredWeights));
}
-inline double DefaultSimilarity::tf(double freq) {
+double DefaultSimilarity::tf(double freq) {
return (double)std::sqrt(freq);
}
-inline double DefaultSimilarity::sloppyFreq(int32_t distance) {
+double DefaultSimilarity::sloppyFreq(int32_t distance) {
return (1.0 / (double)(distance + 1));
}
-inline double DefaultSimilarity::idf(int32_t docFreq, int32_t numDocs) {
+double DefaultSimilarity::idf(int32_t docFreq, int32_t numDocs) {
return (double)(std::log((double)numDocs / (double)(docFreq + 1)) + 1.0);
}
-inline double DefaultSimilarity::coord(int32_t overlap, int32_t maxOverlap) {
+double DefaultSimilarity::coord(int32_t overlap, int32_t maxOverlap) {
return (double)overlap / (double)maxOverlap;
}
-inline void DefaultSimilarity::setDiscountOverlaps(bool v) {
+void DefaultSimilarity::setDiscountOverlaps(bool v) {
discountOverlaps = v;
}
-inline bool DefaultSimilarity::getDiscountOverlaps() {
+bool DefaultSimilarity::getDiscountOverlaps() {
return discountOverlaps;
}