SOLR-947: QueryParsing.toString() should check firstly ConstantScoreRangeQuery then RangeQuery.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@730514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2009-01-01 06:50:50 +00:00
parent d9e76a7cca
commit 1d43a36bf9
2 changed files with 25 additions and 22 deletions

View File

@ -210,6 +210,9 @@ Bug Fixes
24. SOLR-902: FastInputStream#read(byte b[], int off, int len) gives incorrect results when amount left to read is less
than buffer size (Noble Paul via shalin)
25. SOLR-947: ConstantScoreRangeQuery should be checked before RangeQuery in QueryParsing.toString().
This causes NPE when requesting open ended range query with debugQuery=on (koji)
Other Changes
----------------------

View File

@ -317,6 +317,28 @@ public class QueryParsing {
Term t = q.getTerm();
FieldType ft = writeFieldName(t.field(), schema, out, flags);
writeFieldVal(t.text(), ft, out, flags);
} else if (query instanceof ConstantScoreRangeQuery) {
ConstantScoreRangeQuery q = (ConstantScoreRangeQuery)query;
String fname = q.getField();
FieldType ft = writeFieldName(fname, schema, out, flags);
out.append( q.includesLower() ? '[' : '{' );
String lt = q.getLowerVal();
String ut = q.getUpperVal();
if (lt==null) {
out.append('*');
} else {
writeFieldVal(lt, ft, out, flags);
}
out.append(" TO ");
if (ut==null) {
out.append('*');
} else {
writeFieldVal(ut, ft, out, flags);
}
out.append( q.includesUpper() ? ']' : '}' );
} else if (query instanceof RangeQuery) {
RangeQuery q = (RangeQuery)query;
String fname = q.getField();
@ -340,28 +362,6 @@ public class QueryParsing {
out.append( q.isInclusive() ? ']' : '}' );
} else if (query instanceof ConstantScoreRangeQuery) {
ConstantScoreRangeQuery q = (ConstantScoreRangeQuery)query;
String fname = q.getField();
FieldType ft = writeFieldName(fname, schema, out, flags);
out.append( q.includesLower() ? '[' : '{' );
String lt = q.getLowerVal();
String ut = q.getUpperVal();
if (lt==null) {
out.append('*');
} else {
writeFieldVal(lt, ft, out, flags);
}
out.append(" TO ");
if (ut==null) {
out.append('*');
} else {
writeFieldVal(ut, ft, out, flags);
}
out.append( q.includesUpper() ? ']' : '}' );
} else if (query instanceof BooleanQuery) {
BooleanQuery q = (BooleanQuery)query;
boolean needParens=false;