[TEST] fix lucene query comparison in RangeQueryBuilderTest

The expected query needs to use BytesRef to represent the from and to, otherwise we try to compare BytesRef with String and that returns false.
This commit is contained in:
javanna 2015-07-02 15:27:26 +02:00 committed by Luca Cavanna
parent 912e2ee69e
commit 88e3d6c4bc
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ public class RangeQueryBuilderTest extends BaseQueryTestCase<RangeQueryBuilder>
dateTimeZone = DateTimeZone.forID(queryBuilder.timeZone());
}
MappedFieldType mapper = context.fieldMapper(queryBuilder.fieldName());
expectedQuery = ((DateFieldMapper.DateFieldType) mapper).rangeQuery(queryBuilder.from(), queryBuilder.to(),
expectedQuery = ((DateFieldMapper.DateFieldType) mapper).rangeQuery(BytesRefs.toBytesRef(queryBuilder.from()), BytesRefs.toBytesRef(queryBuilder.to()),
queryBuilder.includeLower(), queryBuilder.includeUpper(), dateTimeZone, forcedDateParser, context);
} else if (queryBuilder.fieldName().equals(INT_FIELD_NAME)) {
expectedQuery = NumericRangeQuery.newIntRange(INT_FIELD_NAME, (Integer) queryBuilder.from(), (Integer) queryBuilder.to(),