Skip to content

Commit

Permalink
Make sure KeywordFieldMapper#clone preserves split_queries_on_whitesp…
Browse files Browse the repository at this point in the history
…ace. (#31049)

(cherry picked from commit 30a8f9d)
  • Loading branch information
jtibshirani committed Jun 4, 2018
1 parent 9a8a1fd commit 11b001d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public KeywordFieldType() {
protected KeywordFieldType(KeywordFieldType ref) {
super(ref);
this.normalizer = ref.normalizer;
this.splitQueriesOnWhitespace = splitQueriesOnWhitespace;
this.splitQueriesOnWhitespace = ref.splitQueriesOnWhitespace;
}

public KeywordFieldType clone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
});
}
Expand Down

0 comments on commit 11b001d

Please sign in to comment.