You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by no...@apache.org on 2009/11/26 09:25:31 UTC

svn commit: r884456 - /lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java

Author: noble
Date: Thu Nov 26 08:25:30 2009
New Revision: 884456

URL: http://svn.apache.org/viewvc?rev=884456&view=rev
Log:
SOLR-1516

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java?rev=884456&r1=884455&r2=884456&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/BaseResponseWriter.java Thu Nov 26 08:25:30 2009
@@ -88,10 +88,9 @@
         if (omitHeader == null || !omitHeader) responseWriter.writeResponseHeader((NamedList) val);
       } else if (val instanceof SolrDocumentList) {
         SolrDocumentList list = (SolrDocumentList) val;
-        DocListInfo info = new DocListInfo(list.getNumFound(), list.getStart(),
-            list.getMaxScore());
+        DocListInfo info = new DocListInfo((int)list.getNumFound(), list.size(), (int)list.getStart(), list.getMaxScore());
         if (responseWriter.isStreamingDocs()) {
-          responseWriter.startDocumentList(info);
+          responseWriter.startDocumentList(name,info);
           for (SolrDocument solrDocument : list)
             responseWriter.writeDoc(solrDocument);
           responseWriter.endDocumentList();
@@ -103,11 +102,11 @@
         int sz = docList.size();
         IdxInfo idxInfo = new IdxInfo(request.getSchema(), request
             .getSearcher(), response.getReturnFields());
-        DocListInfo info = new DocListInfo(docList.matches(), docList.offset(),
+        DocListInfo info = new DocListInfo(docList.matches(), docList.size(),docList.offset(),
             docList.maxScore());
         DocIterator iterator = docList.iterator();
         if (responseWriter.isStreamingDocs()) {
-          responseWriter.startDocumentList(info);
+          responseWriter.startDocumentList(name,info);
           for (int j = 0; j < sz; j++) {
             SolrDocument sdoc = getDoc(iterator.nextDoc(), idxInfo);
             if (idxInfo.includeScore && docList.hasScores()) {
@@ -207,12 +206,14 @@
   }
 
   public static class DocListInfo {
-    public long numFound = 0;
-    public long start = 0;
+    public final int numFound;
+    public final int start ;
     public Float maxScore = null;
+    public final int size;
 
-    public DocListInfo(long numFound, long start, Float maxScore) {
+    public DocListInfo(int numFound, int sz,int start, Float maxScore) {
       this.numFound = numFound;
+      size = sz;
       this.start = start;
       this.maxScore = maxScore;
     }
@@ -245,7 +246,7 @@
      * 
      * @param info Information about the {@link SolrDocumentList} to output.
      */
-    public void startDocumentList(DocListInfo info) throws IOException { }
+    public void startDocumentList(String name, DocListInfo info) throws IOException { }
 
     /**
      * This method writes out a {@link SolrDocument}, on a doc-by-doc basis.