Bump Lucene version to 4.10

Change-Id: Id13cde38fd640130f31e9a78d8d4da5d7c280649
This commit is contained in:
David Ostrovsky 2014-08-19 21:36:14 +02:00 committed by Dave Borowitz
parent 661683471a
commit 4995c3d90e
5 changed files with 19 additions and 26 deletions

View File

@ -82,7 +82,7 @@ class AutoCommitWriter extends IndexWriter {
}
@Override
public void deleteDocuments(Term term) throws IOException {
public void deleteDocuments(Term... term) throws IOException {
super.deleteDocuments(term);
autoFlush();
}
@ -97,18 +97,6 @@ class AutoCommitWriter extends IndexWriter {
return ret;
}
@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);

View File

@ -136,6 +136,8 @@ public class LuceneChangeIndex implements ChangeIndex {
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 @@ public class LuceneChangeIndex implements ChangeIndex {
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 @@ public class LuceneChangeIndex implements ChangeIndex {
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 @@ public class LuceneChangeIndex implements ChangeIndex {
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 =

View File

@ -43,7 +43,7 @@ import org.apache.lucene.search.PrefixQuery;
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 @@ public class QueryBuilder {
}
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)

View File

@ -243,7 +243,8 @@ public class ChangeSchemas {
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);

View File

@ -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(
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(
maven_jar(
name = 'query-parser',
id = 'org.apache.lucene:lucene-queryparser:' + VERSION,
sha1 = 'f3e105d74137906fdeb2c7bc4dd68c08564778f9',
sha1 = '7a00eb4b97a6cb7a5a29957b62c7f002dd71b7ff',
license = 'Apache2.0',
)