Minor FlatObjectFieldMapper fix (#62633)
The splitQueriesOnWhitespace instance field can be made final, and setter and getter are not always needed.
This commit is contained in:
parent
00272ea877
commit
1580fc70bd
|
@ -227,7 +227,6 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
*/
|
*/
|
||||||
public static final class KeyedFlatObjectFieldType extends StringFieldType {
|
public static final class KeyedFlatObjectFieldType extends StringFieldType {
|
||||||
private final String key;
|
private final String key;
|
||||||
private boolean splitQueriesOnWhitespace;
|
|
||||||
|
|
||||||
public KeyedFlatObjectFieldType(String name, boolean indexed, boolean hasDocValues, String key,
|
public KeyedFlatObjectFieldType(String name, boolean indexed, boolean hasDocValues, String key,
|
||||||
boolean splitQueriesOnWhitespace, Map<String, String> meta) {
|
boolean splitQueriesOnWhitespace, Map<String, String> meta) {
|
||||||
|
@ -236,7 +235,6 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
meta);
|
meta);
|
||||||
setIndexAnalyzer(Lucene.KEYWORD_ANALYZER);
|
setIndexAnalyzer(Lucene.KEYWORD_ANALYZER);
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyedFlatObjectFieldType(String name, String key, RootFlatObjectFieldType ref) {
|
private KeyedFlatObjectFieldType(String name, String key, RootFlatObjectFieldType ref) {
|
||||||
|
@ -252,14 +250,6 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean splitQueriesOnWhitespace() {
|
|
||||||
return splitQueriesOnWhitespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSplitQueriesOnWhitespace(boolean splitQueriesOnWhitespace) {
|
|
||||||
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query existsQuery(QueryShardContext context) {
|
public Query existsQuery(QueryShardContext context) {
|
||||||
Term term = new Term(name(), FlatObjectFieldParser.createKeyedValue(key, ""));
|
Term term = new Term(name(), FlatObjectFieldParser.createKeyedValue(key, ""));
|
||||||
|
@ -438,7 +428,7 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
* searches on the flat object field itself, e.g. 'my_flat_object: some_value'.
|
* searches on the flat object field itself, e.g. 'my_flat_object: some_value'.
|
||||||
*/
|
*/
|
||||||
public static final class RootFlatObjectFieldType extends StringFieldType {
|
public static final class RootFlatObjectFieldType extends StringFieldType {
|
||||||
private boolean splitQueriesOnWhitespace;
|
private final boolean splitQueriesOnWhitespace;
|
||||||
|
|
||||||
public RootFlatObjectFieldType(String name, boolean indexed, boolean hasDocValues, Map<String, String> meta,
|
public RootFlatObjectFieldType(String name, boolean indexed, boolean hasDocValues, Map<String, String> meta,
|
||||||
boolean splitQueriesOnWhitespace) {
|
boolean splitQueriesOnWhitespace) {
|
||||||
|
@ -453,14 +443,6 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
return CONTENT_TYPE;
|
return CONTENT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean splitQueriesOnWhitespace() {
|
|
||||||
return splitQueriesOnWhitespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSplitQueriesOnWhitespace(boolean splitQueriesOnWhitespace) {
|
|
||||||
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object valueForDisplay(Object value) {
|
public Object valueForDisplay(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -596,8 +578,8 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
||||||
builder.field("null_value", nullValue);
|
builder.field("null_value", nullValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeDefaults || fieldType().splitQueriesOnWhitespace()) {
|
if (includeDefaults || fieldType().splitQueriesOnWhitespace) {
|
||||||
builder.field("split_queries_on_whitespace", fieldType().splitQueriesOnWhitespace());
|
builder.field("split_queries_on_whitespace", fieldType().splitQueriesOnWhitespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue