Make sure KeywordFieldMapper#clone preserves split_queries_on_whitespace. (#31049)
This commit is contained in:
parent
7e565797e7
commit
30a8f9d948
|
@ -198,7 +198,7 @@ public final class KeywordFieldMapper extends FieldMapper {
|
||||||
protected KeywordFieldType(KeywordFieldType ref) {
|
protected KeywordFieldType(KeywordFieldType ref) {
|
||||||
super(ref);
|
super(ref);
|
||||||
this.normalizer = ref.normalizer;
|
this.normalizer = ref.normalizer;
|
||||||
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
|
this.splitQueriesOnWhitespace = ref.splitQueriesOnWhitespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeywordFieldType clone() {
|
public KeywordFieldType clone() {
|
||||||
|
|
|
@ -52,8 +52,15 @@ public class KeywordFieldTypeTests extends FieldTypeTestCase {
|
||||||
public void setupProperties() {
|
public void setupProperties() {
|
||||||
addModifier(new Modifier("normalizer", false) {
|
addModifier(new Modifier("normalizer", false) {
|
||||||
@Override
|
@Override
|
||||||
public void modify(MappedFieldType ft) {
|
public void modify(MappedFieldType type) {
|
||||||
((KeywordFieldType) ft).setNormalizer(Lucene.KEYWORD_ANALYZER);
|
((KeywordFieldType) type).setNormalizer(Lucene.KEYWORD_ANALYZER);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addModifier(new Modifier("split_queries_on_whitespace", true) {
|
||||||
|
@Override
|
||||||
|
public void modify(MappedFieldType type) {
|
||||||
|
KeywordFieldType keywordType = (KeywordFieldType) type;
|
||||||
|
keywordType.setSplitQueriesOnWhitespace(!keywordType.splitQueriesOnWhitespace());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue