Skip to content

Commit

Permalink
Make sure MatchQueryBuilderTests only lowercases values for text fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Nov 7, 2018
1 parent d5213c8 commit 7a3c18e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ protected void doAssertLuceneQuery(MatchQueryBuilder queryBuilder, Query query,
MappedFieldType fieldType = context.fieldMapper(queryBuilder.fieldName());
if (query instanceof TermQuery && fieldType != null) {
String queryValue = queryBuilder.value().toString();
if (queryBuilder.analyzer() == null || queryBuilder.analyzer().equals("simple")) {
if (isTextField(queryBuilder.fieldName())
&& (queryBuilder.analyzer() == null || queryBuilder.analyzer().equals("simple"))) {
queryValue = queryValue.toLowerCase(Locale.ROOT);
}
Query expectedTermQuery = fieldType.termQuery(queryValue, context);
Expand Down

0 comments on commit 7a3c18e

Please sign in to comment.