From be28a247ec528dfdb0d8f922b38f60ffcdf4d1da Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 9 Jan 2008 15:14:09 +0000 Subject: [PATCH] SOLR-434 - change interfaces should support >2B docs git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@610414 13f79535-47bb-0310-9956-ffa450edef68 --- .../client/solrj/impl/XMLResponseParser.java | 4 ++-- .../solr/client/solrj/response/FacetField.java | 14 +++++++------- .../client/solrj/response/QueryResponse.java | 11 ++++++----- .../org/apache/solr/common/SolrDocumentList.java | 12 ++++++------ .../apache/solr/request/JSONResponseWriter.java | 4 ++-- src/java/org/apache/solr/request/XMLWriter.java | 16 ++++++++-------- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java b/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java index dc8b64b4ada..f17c214b967 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java @@ -313,10 +313,10 @@ public class XMLResponseParser implements ResponseParser String n = parser.getAttributeLocalName( i ); String v = parser.getAttributeValue( i ); if( "numFound".equals( n ) ) { - docs.setNumFound( Integer.parseInt( v ) ); + docs.setNumFound( Long.parseLong( v ) ); } else if( "start".equals( n ) ) { - docs.setStart( Integer.parseInt( v ) ); + docs.setStart( Long.parseLong( v ) ); } else if( "maxScore".equals( n ) ) { docs.setMaxScore( Float.parseFloat( v ) ); diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/response/FacetField.java b/client/java/solrj/src/org/apache/solr/client/solrj/response/FacetField.java index c784afc351c..42ec2ab0bd7 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/response/FacetField.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/response/FacetField.java @@ -35,11 +35,11 @@ import org.apache.solr.client.solrj.util.ClientUtils; public static class Count implements Serializable { private String _name = null; - private int _count = 0; + private long _count = 0; // hang onto the FacetField for breadcrumb creation convenience private FacetField _ff = null; - public Count( FacetField ff, String n, int c ) + public Count( FacetField ff, String n, long c ) { _name = n; _count = c; @@ -55,11 +55,11 @@ import org.apache.solr.client.solrj.util.ClientUtils; _name = n; } - public int getCount() { + public long getCount() { return _count; } - public void setCount( int c ) + public void setCount( long c ) { _count = c; } @@ -95,7 +95,7 @@ import org.apache.solr.client.solrj.util.ClientUtils; /** * Insert at the end of the list */ - public void add( String name, int cnt ) + public void add( String name, long cnt ) { if( _values == null ) { _values = new ArrayList( 30 ); @@ -106,7 +106,7 @@ import org.apache.solr.client.solrj.util.ClientUtils; /** * Insert at the beginning of the list. */ - public void insert( String name, int cnt ) + public void insert( String name, long cnt ) { if( _values == null ) { _values = new ArrayList( 30 ); @@ -127,7 +127,7 @@ import org.apache.solr.client.solrj.util.ClientUtils; return _values == null ? 0 : _values.size(); } - public FacetField getLimitingFields(int max) + public FacetField getLimitingFields(long max) { FacetField ff = new FacetField( _name ); if( _values != null ) { diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/response/QueryResponse.java b/client/java/solrj/src/org/apache/solr/client/solrj/response/QueryResponse.java index 8471d298dfb..d754e29f9d8 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/response/QueryResponse.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/response/QueryResponse.java @@ -135,16 +135,17 @@ public class QueryResponse extends SolrResponseBase } // Parse the facet info into fields - NamedList> ff = (NamedList>) info.get( "facet_fields" ); + // TODO?? The list could be or ? If always then we can switch to + NamedList> ff = (NamedList>) info.get( "facet_fields" ); if( ff != null ) { _facetFields = new ArrayList( ff.size() ); _limitingFacets = new ArrayList( ff.size() ); - int minsize = _results.getNumFound(); - for( Map.Entry> facet : ff ) { + long minsize = _results.getNumFound(); + for( Map.Entry> facet : ff ) { FacetField f = new FacetField( facet.getKey() ); - for( Map.Entry entry : facet.getValue() ) { - f.add( entry.getKey(), entry.getValue() ); + for( Map.Entry entry : facet.getValue() ) { + f.add( entry.getKey(), entry.getValue().longValue() ); } _facetFields.add( f ); diff --git a/src/java/org/apache/solr/common/SolrDocumentList.java b/src/java/org/apache/solr/common/SolrDocumentList.java index 2f05029c4f6..715518f109e 100644 --- a/src/java/org/apache/solr/common/SolrDocumentList.java +++ b/src/java/org/apache/solr/common/SolrDocumentList.java @@ -29,8 +29,8 @@ import java.util.ArrayList; */ public class SolrDocumentList extends ArrayList { - private int numFound = 0; - private int start = 0; + private long numFound = 0; + private long start = 0; private Float maxScore = null; public Float getMaxScore() { @@ -41,19 +41,19 @@ public class SolrDocumentList extends ArrayList this.maxScore = maxScore; } - public int getNumFound() { + public long getNumFound() { return numFound; } - public void setNumFound(int numFound) { + public void setNumFound(long numFound) { this.numFound = numFound; } - public int getStart() { + public long getStart() { return start; } - public void setStart(int start) { + public void setStart(long start) { this.start = start; } } diff --git a/src/java/org/apache/solr/request/JSONResponseWriter.java b/src/java/org/apache/solr/request/JSONResponseWriter.java index 5097e68c6b1..b0156301634 100644 --- a/src/java/org/apache/solr/request/JSONResponseWriter.java +++ b/src/java/org/apache/solr/request/JSONResponseWriter.java @@ -516,10 +516,10 @@ class JSONWriter extends TextResponseWriter { writeMapOpener(includeScore ? 4 : 3); incLevel(); writeKey("numFound",false); - writeInt(null,docs.getNumFound()); + writeLong(null,docs.getNumFound()); writeMapSeparator(); writeKey("start",false); - writeInt(null,docs.getStart()); + writeLong(null,docs.getStart()); if (includeScore) { writeMapSeparator(); diff --git a/src/java/org/apache/solr/request/XMLWriter.java b/src/java/org/apache/solr/request/XMLWriter.java index e3ef1aaea50..ecd18c150ce 100644 --- a/src/java/org/apache/solr/request/XMLWriter.java +++ b/src/java/org/apache/solr/request/XMLWriter.java @@ -375,8 +375,8 @@ final public class XMLWriter { private static interface DocumentListInfo { Float getMaxScore(); int getCount(); - int getNumFound(); - int getStart(); + long getNumFound(); + long getStart(); void writeDocs( boolean includeScore, Set fields ) throws IOException; } @@ -398,8 +398,8 @@ final public class XMLWriter { writer.write("