Make sure KeywordFieldMapper#clone preserves split_queries_on_whitespace. (#31049)

This commit is contained in:
Julie Tibshirani 2018-06-04 08:42:32 -07:00 committed by GitHub
parent 7e565797e7
commit 30a8f9d948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -198,7 +198,7 @@ public final class KeywordFieldMapper extends FieldMapper {
protected KeywordFieldType(KeywordFieldType ref) {
super(ref);
this.normalizer = ref.normalizer;
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
this.splitQueriesOnWhitespace = ref.splitQueriesOnWhitespace;
}
public KeywordFieldType clone() {

View File

@ -52,8 +52,15 @@ public class KeywordFieldTypeTests extends FieldTypeTestCase {
public void setupProperties() {
addModifier(new Modifier("normalizer", false) {
@Override
public void modify(MappedFieldType ft) {
((KeywordFieldType) ft).setNormalizer(Lucene.KEYWORD_ANALYZER);
public void modify(MappedFieldType type) {
((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());
}
});
}