Bug 545395 - Update platform.ua to Lucene 8.0
Change-Id: I2d4135cf79d60bb503677c44c27ff4b26be242df
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/org.eclipse.help.base/META-INF/MANIFEST.MF b/org.eclipse.help.base/META-INF/MANIFEST.MF
index 91c3617..fdd8060 100644
--- a/org.eclipse.help.base/META-INF/MANIFEST.MF
+++ b/org.eclipse.help.base/META-INF/MANIFEST.MF
@@ -44,9 +44,9 @@
org.eclipse.help;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)",
org.eclipse.core.net;bundle-version="[1.2.200,2.0.0]",
- org.apache.lucene.analyzers-common;bundle-version="[7.0.0,8.0.0)",
- org.apache.lucene.core;bundle-version="[7.0.0,8.0.0)",
- org.apache.lucene.analyzers-smartcn;bundle-version="[7.0.0,8.0.0)"
+ org.apache.lucene.analyzers-common;bundle-version="[8.0.0,9.0.0)",
+ org.apache.lucene.core;bundle-version="[8.0.0,9.0.0)",
+ org.apache.lucene.analyzers-smartcn;bundle-version="[8.0.0,9.0.0)"
Import-Package: com.ibm.icu.text,
org.eclipse.equinox.http.jetty;resolution:=optional
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
index b4f21e0..cdc550e 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,9 +20,10 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharArraySet;
+import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
-import org.apache.lucene.analysis.core.StopFilter;
+import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.en.PorterStemFilter;
/**
@@ -44,9 +45,9 @@
@SuppressWarnings("resource")
@Override
protected TokenStreamComponents createComponents(String fieldName) {
- final Tokenizer source;
- source = new LowerCaseAndDigitsTokenizer();
+ final Tokenizer source = new CharAndDigitsTokenizer();
TokenStream result = new StopFilter(source, new CharArraySet(getStopWords(), false));
+ result = new LowerCaseFilter(result);
result = new PorterStemFilter(result);
return new TokenStreamComponents(source, result);
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LowerCaseAndDigitsTokenizer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/CharAndDigitsTokenizer.java
similarity index 80%
rename from org.eclipse.help.base/src/org/eclipse/help/internal/search/LowerCaseAndDigitsTokenizer.java
rename to org.eclipse.help.base/src/org/eclipse/help/internal/search/CharAndDigitsTokenizer.java
index 7053a10..f19bcfa 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LowerCaseAndDigitsTokenizer.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/CharAndDigitsTokenizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -21,16 +21,10 @@
* Tokenizer breaking words around letters or digits. Also normalizes to lower
* case.
*/
-public class LowerCaseAndDigitsTokenizer extends CharTokenizer {
+public class CharAndDigitsTokenizer extends CharTokenizer {
@Override
protected boolean isTokenChar(int c) {
return Character.isLetterOrDigit(c);
}
-
- @Override
- protected int normalize(int c) {
- return Character.toLowerCase(c);
- }
-
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
index 27e820f..9397a66 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
@@ -758,9 +758,9 @@
}
Version luceneVersion = new Version(luceneVersionString);
Version indexVersion = new Version(indexVersionString);
- Version v700 = new Version(7, 0, 0);
- if (indexVersion.compareTo(v700) < 0) {
- // index is older than Lucene 7.0.0
+ Version v800 = new Version(8, 0, 0);
+ if (indexVersion.compareTo(v800) < 0) {
+ // index is older than Lucene 8.0.0
return false;
}
if ( luceneVersion.compareTo(indexVersion) >= 0 ) {
diff --git a/org.eclipse.ua.tests/META-INF/MANIFEST.MF b/org.eclipse.ua.tests/META-INF/MANIFEST.MF
index 7301b0c..c6e0e89 100644
--- a/org.eclipse.ua.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.ua.tests/META-INF/MANIFEST.MF
@@ -20,9 +20,9 @@
org.eclipse.ui.browser;bundle-version="3.2.300",
org.eclipse.equinox.jsp.jasper;bundle-version="1.0.200",
org.eclipse.equinox.jsp.jasper.registry;bundle-version="1.0.100",
- org.apache.lucene.analyzers-common;bundle-version="7.0.0",
- org.apache.lucene.analyzers-smartcn;bundle-version="7.0.0",
- org.apache.lucene.core;bundle-version="7.0.0"
+ org.apache.lucene.analyzers-common;bundle-version="8.0.0",
+ org.apache.lucene.analyzers-smartcn;bundle-version="8.0.0",
+ org.apache.lucene.core;bundle-version="8.0.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse.org
Import-Package: javax.servlet;version="3.1.0",
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdt b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdt
new file mode 100644
index 0000000..db4a61f
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdt
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdx b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdx
new file mode 100644
index 0000000..c657abd
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fdx
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fnm b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fnm
new file mode 100644
index 0000000..53c73bc
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.fnm
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvd b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvd
new file mode 100644
index 0000000..237dcb3
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvd
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvm b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvm
new file mode 100644
index 0000000..a3fbaa1
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.nvm
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1.si b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.si
new file mode 100644
index 0000000..105925c
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1.si
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.doc b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.doc
new file mode 100644
index 0000000..366eeee
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.doc
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.pos b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.pos
new file mode 100644
index 0000000..fe8ae27
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.pos
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tim b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tim
new file mode 100644
index 0000000..50d8903
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tim
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tip b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tip
new file mode 100644
index 0000000..95a8c32
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/_1_Lucene50_0.tip
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_contributions b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_contributions
new file mode 100644
index 0000000..23a1b5e
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_contributions
@@ -0,0 +1,8 @@
+#This is a generated file; do not edit.
+#Thu Mar 28 18:54:06 EET 2019
+org.eclipse.help=org.eclipse.help\n3.8.400.qualifier
+org.eclipse.ui.cheatsheets=org.eclipse.ui.cheatsheets\n3.5.400.qualifier
+org.eclipse.platform=org.eclipse.platform\n4.12.0.v20190325-1800
+org.eclipse.ui.intro=org.eclipse.ui.intro\n3.5.600.qualifier
+helptest=helptest\n1.0.0.qualifier
+org.eclipse.help.base=org.eclipse.help.base\n4.2.600.qualifier
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_dependencies b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_dependencies
new file mode 100644
index 0000000..f61f651
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_dependencies
@@ -0,0 +1,4 @@
+#This is a generated file; do not edit.
+#Thu Mar 28 18:54:06 EET 2019
+analyzer=org.eclipse.help.base\#4.2.600.qualifier?locale\=en
+lucene=8.0.0.v20190326-1635
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_docs b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_docs
new file mode 100644
index 0000000..309e42c
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/indexed_docs
@@ -0,0 +1,5 @@
+#This is a generated file; do not edit.
+#Thu Mar 28 18:54:06 EET 2019
+/helptest/html/subtopic.html=0
+/helptest/html/toc.html=0
+/helptest/html/maintopic.html=0
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/segments_1 b/org.eclipse.ua.tests/data/help/searchindex/index800/segments_1
new file mode 100644
index 0000000..aeac473
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/segments_1
Binary files differ
diff --git a/org.eclipse.ua.tests/data/help/searchindex/index800/write.lock b/org.eclipse.ua.tests/data/help/searchindex/index800/write.lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/searchindex/index800/write.lock
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
index f3301db..94b828a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2016 IBM Corporation and others.
+ * Copyright (c) 2011, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -86,7 +86,7 @@
/**
* Test index built with Lucene 6.1.0
*/
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = IndexFormatTooOldException.class)
public void test6_1_0_IndexUnReadable() throws Exception {
checkReadable("data/help/searchindex/index610");
}
@@ -94,12 +94,20 @@
/**
* Test index built with Lucene 7.0.0
*/
- @Test
- public void test7_0_0_IndexReadable() throws Exception {
+ @Test(expected = IndexFormatTooOldException.class)
+ public void test7_0_0_IndexUnReadable() throws Exception {
checkReadable("data/help/searchindex/index700");
}
/**
+ * Test index built with Lucene 8.0.0
+ */
+ @Test
+ public void test8_0_0_IndexReadable() throws Exception {
+ checkReadable("data/help/searchindex/index800");
+ }
+
+ /**
** Test compatibility of Lucene 1.9.1 index with current Lucene
*/
@Test
@@ -138,7 +146,7 @@
*/
@Test
public void test7_0_0Compatible() {
- checkCompatible("data/help/searchindex/index700", true);
+ checkCompatible("data/help/searchindex/index700", false);
}
@Test
@@ -171,7 +179,12 @@
@Test
public void test7_0_0LuceneCompatible() {
- checkLuceneCompatible("7.0.0", true);
+ checkLuceneCompatible("7.0.0", false);
+ }
+
+ @Test
+ public void test8_0_0LuceneCompatible() {
+ checkLuceneCompatible("8.0.0", true);
}
@Test
@@ -227,7 +240,7 @@
try (Directory luceneDirectory = new NIOFSDirectory(new File(filePath).toPath())) {
searcher = new IndexSearcher(DirectoryReader.open(luceneDirectory));
TopDocs hits = searcher.search(luceneQuery, 500);
- assertTrue(hits.totalHits >= 1);
+ assertTrue(hits.totalHits.value >= 1);
}
} else {
fail("Cannot resolve to file protocol");
@@ -263,5 +276,4 @@
index);
assertEquals(expected, index.isLuceneCompatible(version));
}
-
}