lucene 4: fix possible NPE in range queries and filters if one of the bounds is not specified

This commit is contained in:
Igor Motov 2012-11-04 22:38:14 -05:00 committed by Shay Banon
parent 6d40770200
commit 74464f9f99
2 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ public class RangeFilterParser implements FilterParser {
if (smartNameFieldMappers != null) {
if (smartNameFieldMappers.hasMapper()) {
//LUCENE 4 UPGRADE range filter should use bytesref too?
filter = smartNameFieldMappers.mapper().rangeFilter(from.utf8ToString(), to.utf8ToString(), includeLower, includeUpper, parseContext);
filter = smartNameFieldMappers.mapper().rangeFilter(from != null ? from.utf8ToString() : null, to != null ? to.utf8ToString() : null, includeLower, includeUpper, parseContext);
}
}
if (filter == null) {

View File

@ -110,7 +110,7 @@ public class RangeQueryParser implements QueryParser {
if (smartNameFieldMappers != null) {
if (smartNameFieldMappers.hasMapper()) {
//LUCENE 4 UPGRADE Mapper#rangeQuery should use bytesref as well?
query = smartNameFieldMappers.mapper().rangeQuery(from.utf8ToString(), to.utf8ToString(), includeLower, includeUpper, parseContext);
query = smartNameFieldMappers.mapper().rangeQuery(from != null ? from.utf8ToString() : null, to != null ? to.utf8ToString() : null, includeLower, includeUpper, parseContext);
}
}
if (query == null) {