From f777daef3de53fa707090ee0d6184d904cc0971b Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Wed, 13 Apr 2011 14:24:12 +0000 Subject: [PATCH] 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 --- solr/src/java/org/apache/solr/response/PageTool.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/solr/src/java/org/apache/solr/response/PageTool.java b/solr/src/java/org/apache/solr/response/PageTool.java index 6a664d63871..42bf31e5a23 100644 --- a/solr/src/java/org/apache/solr/response/PageTool.java +++ b/solr/src/java/org/apache/solr/response/PageTool.java @@ -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"); } }