Bump Lucene version to 4.10
Change-Id: Id13cde38fd640130f31e9a78d8d4da5d7c280649
diff --git a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/AutoCommitWriter.java b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/AutoCommitWriter.java
index fd14cd9..e0c13ae 100644
--- a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/AutoCommitWriter.java
+++ b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/AutoCommitWriter.java
@@ -82,7 +82,7 @@
}
@Override
- public void deleteDocuments(Term term) throws IOException {
+ public void deleteDocuments(Term... term) throws IOException {
super.deleteDocuments(term);
autoFlush();
}
@@ -98,18 +98,6 @@
}
@Override
- public void deleteDocuments(Term... terms) throws IOException {
- super.deleteDocuments(terms);
- autoFlush();
- }
-
- @Override
- public void deleteDocuments(Query query) throws IOException {
- super.deleteDocuments(query);
- autoFlush();
- }
-
- @Override
public void deleteDocuments(Query... queries) throws IOException {
super.deleteDocuments(queries);
autoFlush();
diff --git a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
index 365f7e9..2faece4 100644
--- a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
+++ b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
@@ -136,6 +136,8 @@
Version lucene46 = Version.LUCENE_46;
@SuppressWarnings("deprecation")
Version lucene47 = Version.LUCENE_47;
+ @SuppressWarnings("deprecation")
+ Version lucene48 = Version.LUCENE_48;
for (Map.Entry<Integer, Schema<ChangeData>> e
: ChangeSchemas.ALL.entrySet()) {
if (e.getKey() <= 3) {
@@ -146,8 +148,10 @@
versions.put(e.getValue(), lucene46);
} else if (e.getKey() <= 10) {
versions.put(e.getValue(), lucene47);
+ } else if (e.getKey() <= 11) {
+ versions.put(e.getValue(), lucene48);
} else {
- versions.put(e.getValue(), Version.LUCENE_48);
+ versions.put(e.getValue(), Version.LUCENE_4_10_0);
}
}
LUCENE_VERSIONS = versions.build();
@@ -175,7 +179,7 @@
private GerritIndexWriterConfig(Version version, Config cfg, String name) {
CustomMappingAnalyzer analyzer =
- new CustomMappingAnalyzer(new StandardAnalyzer(version,
+ new CustomMappingAnalyzer(new StandardAnalyzer(
CharArraySet.EMPTY_SET), CUSTOM_CHAR_MAPPING);
luceneConfig = new IndexWriterConfig(version, analyzer);
luceneConfig.setOpenMode(OpenMode.CREATE_OR_APPEND);
@@ -241,8 +245,8 @@
LUCENE_VERSIONS.get(schema),
"unknown Lucene version for index schema: %s", schema);
CustomMappingAnalyzer analyzer =
- new CustomMappingAnalyzer(new StandardAnalyzer(luceneVersion,
- CharArraySet.EMPTY_SET), CUSTOM_CHAR_MAPPING);
+ new CustomMappingAnalyzer(new StandardAnalyzer(CharArraySet.EMPTY_SET),
+ CUSTOM_CHAR_MAPPING);
queryBuilder = new QueryBuilder(schema, analyzer);
GerritIndexWriterConfig openConfig =
diff --git a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/QueryBuilder.java b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/QueryBuilder.java
index dfe3f2d..fecd77a 100644
--- a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/QueryBuilder.java
+++ b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/QueryBuilder.java
@@ -43,7 +43,7 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.RegexpQuery;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.NumericUtils;
import java.util.Date;
@@ -154,9 +154,9 @@
}
private static Term intTerm(String name, int value) {
- BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_INT);
- NumericUtils.intToPrefixCodedBytes(value, 0, bytes);
- return new Term(name, bytes);
+ BytesRefBuilder builder = new BytesRefBuilder();
+ NumericUtils.intToPrefixCodedBytes(value, 0, builder);
+ return new Term(name, builder.get());
}
private Query intQuery(IndexPredicate<ChangeData> p)
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeSchemas.java b/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeSchemas.java
index 8bb8f0b..a1ba14b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeSchemas.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeSchemas.java
@@ -243,7 +243,8 @@
ChangeField.DELETED,
ChangeField.DELTA);
-
+ // For upgrade to Lucene 4.10.0 index format only.
+ static final Schema<ChangeData> V12 = release(V11.getFields().values());
private static Schema<ChangeData> release(Collection<FieldDef<ChangeData, ?>> fields) {
return new Schema<>(true, fields);
diff --git a/lib/lucene/BUCK b/lib/lucene/BUCK
index 9ccc5aa..dd148b1 100644
--- a/lib/lucene/BUCK
+++ b/lib/lucene/BUCK
@@ -1,11 +1,11 @@
include_defs('//lib/maven.defs')
-VERSION = '4.8.1'
+VERSION = '4.10.0'
maven_jar(
name = 'core',
id = 'org.apache.lucene:lucene-core:' + VERSION,
- sha1 = 'a549eef6316a2c38d4cda932be809107deeaf8a7',
+ sha1 = 'a4ceea9a80e81fe84e81fe4fccce9e9930dc703a',
license = 'Apache2.0',
exclude = [
'META-INF/LICENSE.txt',
@@ -16,7 +16,7 @@
maven_jar(
name = 'analyzers-common',
id = 'org.apache.lucene:lucene-analyzers-common:' + VERSION,
- sha1 = '6e3731524351c83cd21022a23bee5e87f0575555',
+ sha1 = '912962d436d9851dc90091e48251c802d3b65941',
license = 'Apache2.0',
exclude = [
'META-INF/LICENSE.txt',
@@ -27,6 +27,6 @@
maven_jar(
name = 'query-parser',
id = 'org.apache.lucene:lucene-queryparser:' + VERSION,
- sha1 = 'f3e105d74137906fdeb2c7bc4dd68c08564778f9',
+ sha1 = '7a00eb4b97a6cb7a5a29957b62c7f002dd71b7ff',
license = 'Apache2.0',
)