SOLR-1566: fix /browse wrt pseudo fields

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1091797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-04-13 14:24:12 +00:00
parent 34533ad635
commit f777daef3d
1 changed files with 9 additions and 1 deletions

View File

@ -19,8 +19,10 @@ package org.apache.solr.response;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.search.DocList;
import org.apache.solr.search.DocSlice;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
public class PageTool {
private long start;
@ -42,10 +44,16 @@ public class PageTool {
DocSlice doc_slice = (DocSlice) docs;
results_found = doc_slice.matches();
start = doc_slice.offset();
} else {
} else if(docs instanceof ResultContext) {
DocList dl = ((ResultContext) docs).docs;
results_found = dl.matches();
start = dl.offset();
} else if(docs instanceof SolrDocumentList) {
SolrDocumentList doc_list = (SolrDocumentList) docs;
results_found = doc_list.getNumFound();
start = doc_list.getStart();
} else {
throw new SolrException(SolrException.ErrorCode.UNKNOWN, "Unknown response type "+docs+". Expected one of DocSlice, ResultContext or SolrDocumentList");
}
}