mirror of https://github.com/apache/lucene.git
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:
parent
1bcf8208ba
commit
570e22e7af
|
@ -124,8 +124,10 @@ class OldLuceneQParser extends LuceneQParser {
|
||||||
QueryParsing.SortSpec sort = super.getSort(useGlobal);
|
QueryParsing.SortSpec sort = super.getSort(useGlobal);
|
||||||
if (sortStr != null && sortStr.length()>0 && sort.getSort()==null) {
|
if (sortStr != null && sortStr.length()>0 && sort.getSort()==null) {
|
||||||
QueryParsing.SortSpec oldSort = QueryParsing.parseSort(sortStr, getReq().getSchema());
|
QueryParsing.SortSpec oldSort = QueryParsing.parseSort(sortStr, getReq().getSchema());
|
||||||
|
if( oldSort != null ) {
|
||||||
sort.sort = oldSort.sort;
|
sort.sort = oldSort.sort;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return sort;
|
return sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,15 +152,19 @@ public abstract class QParser {
|
||||||
int start = startS != null ? Integer.parseInt(startS) : 0;
|
int start = startS != null ? Integer.parseInt(startS) : 0;
|
||||||
int rows = rowsS != null ? Integer.parseInt(rowsS) : 10;
|
int rows = rowsS != null ? Integer.parseInt(rowsS) : 10;
|
||||||
|
|
||||||
QueryParsing.SortSpec sort;
|
QueryParsing.SortSpec sort = null;
|
||||||
if (sortStr != null) {
|
if (sortStr != null) {
|
||||||
|
// may return null if 'score desc'
|
||||||
sort = QueryParsing.parseSort(sortStr, req.getSchema());
|
sort = QueryParsing.parseSort(sortStr, req.getSchema());
|
||||||
sort.offset = start;
|
|
||||||
sort.num = rows;
|
|
||||||
} else {
|
|
||||||
sort = new QueryParsing.SortSpec(null, start, rows);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( sort == null ) {
|
||||||
|
sort = new QueryParsing.SortSpec(null, start, rows);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sort.offset = start;
|
||||||
|
sort.num = rows;
|
||||||
|
}
|
||||||
return sort;
|
return sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue