Add search fields for # of changed lines.

Based off https://gerrit-review.googlesource.com/#/c/52190, but
implementing the final suggestion of indexing raw delta counts and
allowing arbitrary range queries off of those.

Also upgrade Lucene to 4.8.1 as this was released since the last
schema change (which was on 4.7.0).

Change-Id: Ia8a677e71e133f68eced4c5394df1d23efe7f12a
This commit is contained in:
Jeff Davidson
2014-05-21 18:48:33 -07:00
parent 063f658042
commit 45d0a772e1
19 changed files with 478 additions and 45 deletions

View File

@@ -127,6 +127,8 @@ public class LuceneChangeIndex implements ChangeIndex {
Version lucene44 = Version.LUCENE_44;
@SuppressWarnings("deprecation")
Version lucene46 = Version.LUCENE_46;
@SuppressWarnings("deprecation")
Version lucene47 = Version.LUCENE_47;
for (Map.Entry<Integer, Schema<ChangeData>> e
: ChangeSchemas.ALL.entrySet()) {
if (e.getKey() <= 3) {
@@ -135,8 +137,10 @@ public class LuceneChangeIndex implements ChangeIndex {
versions.put(e.getValue(), lucene44);
} else if (e.getKey() <= 8) {
versions.put(e.getValue(), lucene46);
} else if (e.getKey() <= 10) {
versions.put(e.getValue(), lucene47);
} else {
versions.put(e.getValue(), Version.LUCENE_47);
versions.put(e.getValue(), Version.LUCENE_48);
}
}
LUCENE_VERSIONS = versions.build();
@@ -497,7 +501,7 @@ public class LuceneChangeIndex implements ChangeIndex {
FieldType<?> type = values.getField().getType();
Store store = store(values.getField());
if (type == FieldType.INTEGER) {
if (type == FieldType.INTEGER || type == FieldType.INTEGER_RANGE) {
for (Object value : values.getValues()) {
doc.add(new IntField(name, (Integer) value, store));
}