SOLR-334? The new query parser does not handle 'null' when sort is "score desc"

http://www.nabble.com/Sorting-problem-tf4762114.html

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@592740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-11-07 13:21:03 +00:00
parent 1bcf8208ba
commit 570e22e7af
2 changed files with 12 additions and 6 deletions

View File

@ -124,7 +124,9 @@ class OldLuceneQParser extends LuceneQParser {
QueryParsing.SortSpec sort = super.getSort(useGlobal);
if (sortStr != null && sortStr.length()>0 && sort.getSort()==null) {
QueryParsing.SortSpec oldSort = QueryParsing.parseSort(sortStr, getReq().getSchema());
sort.sort = oldSort.sort;
if( oldSort != null ) {
sort.sort = oldSort.sort;
}
}
return sort;
}

View File

@ -152,15 +152,19 @@ public abstract class QParser {
int start = startS != null ? Integer.parseInt(startS) : 0;
int rows = rowsS != null ? Integer.parseInt(rowsS) : 10;
QueryParsing.SortSpec sort;
QueryParsing.SortSpec sort = null;
if (sortStr != null) {
// may return null if 'score desc'
sort = QueryParsing.parseSort(sortStr, req.getSchema());
sort.offset = start;
sort.num = rows;
} else {
}
if( sort == null ) {
sort = new QueryParsing.SortSpec(null, start, rows);
}
else {
sort.offset = start;
sort.num = rows;
}
return sort;
}