Add keyword type to index type system

Elasticsearch 5.0 introduced different ways to search strings: [1],
either search whole values that we often refer to as keyword search,
or individual tokens, that we usually refer to as full-text search.

To reflect this change and support such fields in gerrit with ES 5 and
higher, add keyword type to gerrit index type system.

[1] https://www.elastic.co/blog/strings-are-dead-long-live-strings
Change-Id: I25bd157cd638695f5a3b533463008fcf7da9ac8d
This commit is contained in:
David Ostrovsky
2018-06-03 23:21:21 +02:00
committed by David Pursehouse
parent 90db6de2e0
commit 506125e71a
3 changed files with 8 additions and 1 deletions

View File

@@ -337,7 +337,7 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
for (Object value : values.getValues()) {
doc.add(new LongField(name, ((Timestamp) value).getTime(), store));
}
} else if (type == FieldType.EXACT || type == FieldType.PREFIX) {
} else if (type == FieldType.KEYWORD || type == FieldType.EXACT || type == FieldType.PREFIX) {
for (Object value : values.getValues()) {
doc.add(new StringField(name, (String) value, store));
}