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
This commit is contained in:
Ryan McKinley 2008-01-09 15:14:09 +00:00
parent 06b3f0eed0
commit be28a247ec
6 changed files with 31 additions and 30 deletions

View File

@ -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 ) );

View File

@ -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<Count>( 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<Count>( 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 ) {

View File

@ -135,16 +135,17 @@ public class QueryResponse extends SolrResponseBase
}
// Parse the facet info into fields
NamedList<NamedList<Integer>> ff = (NamedList<NamedList<Integer>>) info.get( "facet_fields" );
// TODO?? The list could be <int> or <long>? If always <long> then we can switch to <Long>
NamedList<NamedList<Number>> ff = (NamedList<NamedList<Number>>) info.get( "facet_fields" );
if( ff != null ) {
_facetFields = new ArrayList<FacetField>( ff.size() );
_limitingFacets = new ArrayList<FacetField>( ff.size() );
int minsize = _results.getNumFound();
for( Map.Entry<String,NamedList<Integer>> facet : ff ) {
long minsize = _results.getNumFound();
for( Map.Entry<String,NamedList<Number>> facet : ff ) {
FacetField f = new FacetField( facet.getKey() );
for( Map.Entry<String, Integer> entry : facet.getValue() ) {
f.add( entry.getKey(), entry.getValue() );
for( Map.Entry<String, Number> entry : facet.getValue() ) {
f.add( entry.getKey(), entry.getValue().longValue() );
}
_facetFields.add( f );

View File

@ -29,8 +29,8 @@ import java.util.ArrayList;
*/
public class SolrDocumentList extends ArrayList<SolrDocument>
{
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<SolrDocument>
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;
}
}

View File

@ -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();

View File

@ -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<String> fields ) throws IOException;
}
@ -398,8 +398,8 @@ final public class XMLWriter {
writer.write("<result");
writeAttr("name",name);
writeAttr("numFound",Integer.toString(docs.getNumFound())); // TODO: change to long
writeAttr("start",Integer.toString(docs.getStart())); // TODO: change to long
writeAttr("numFound",Long.toString(docs.getNumFound())); // TODO: change to long
writeAttr("start",Long.toString(docs.getStart())); // TODO: change to long
if (includeScore && docs.getMaxScore()!=null) {
writeAttr("maxScore",Float.toString(docs.getMaxScore()));
}
@ -430,11 +430,11 @@ final public class XMLWriter {
return docs.getMaxScore();
}
public int getNumFound() {
public long getNumFound() {
return docs.getNumFound();
}
public int getStart() {
public long getStart() {
return docs.getStart();
}
@ -458,11 +458,11 @@ final public class XMLWriter {
return ids.maxScore();
}
public int getNumFound() {
public long getNumFound() {
return ids.matches();
}
public int getStart() {
public long getStart() {
return ids.offset();
}