diff --git a/src/common/org/apache/solr/common/params/StatsParams.java b/src/common/org/apache/solr/common/params/StatsParams.java index f63cd21d9f3..66c5490bb1b 100644 --- a/src/common/org/apache/solr/common/params/StatsParams.java +++ b/src/common/org/apache/solr/common/params/StatsParams.java @@ -24,5 +24,4 @@ public interface StatsParams { public static final String STATS = "stats"; public static final String STATS_FIELD = STATS + ".field"; public static final String STATS_FACET = STATS + ".facet"; - public static final String STATS_TWOPASS = STATS + ".twopass"; } diff --git a/src/java/org/apache/solr/handler/component/StatsComponent.java b/src/java/org/apache/solr/handler/component/StatsComponent.java index 06fb173a88c..5fe8102d216 100644 --- a/src/java/org/apache/solr/handler/component/StatsComponent.java +++ b/src/java/org/apache/solr/handler/component/StatsComponent.java @@ -181,7 +181,6 @@ class StatsValues { double sumOfSquares; long count; long missing; - Double median = null; // facetField facetValue Map> facets; @@ -251,7 +250,6 @@ class StatsValues { max = Double.MIN_VALUE; sum = count = missing = 0; sumOfSquares = 0; - median = null; facets = null; } @@ -264,9 +262,6 @@ class StatsValues { res.add("missing", missing); res.add("sumOfSquares", sumOfSquares ); res.add("mean", getAverage()); - if( median != null ) { - res.add( "median", median ); - } res.add( "stddev", getStandardDeviation() ); // add the facet stats @@ -435,34 +430,6 @@ class SimpleStats { } } - // Find things that require a 2nd pass - if( params.getFieldBool(fieldName, StatsParams.STATS_TWOPASS, false) ) { - if( allstats.count > 1 ) { // must be 2 or more... - iter = docs.iterator(); - boolean isEven = ( allstats.count % 2) == 0; - int medianIndex = (int) Math.ceil( allstats.count/2.0 ); - for ( i=0; iter.hasNext(); ) { - String raw = all.getTermText(iter.nextDoc()); - if( raw != null ) { - if( ++i == medianIndex ) { - double val0 = Double.parseDouble( all.ft.indexedToReadable(raw) ); - if( isEven ) { - do { - raw = all.getTermText(iter.nextDoc()); - } while( raw == null ); - double val1 = Double.parseDouble( all.ft.indexedToReadable(raw) ); - allstats.median = (val0+val1)/2.0; - } - else { - allstats.median = val0; - } - break; - } - } - } - } // get median - } - if( finfo.length > 0 ) { allstats.facets = new HashMap>(); for( FieldFacetStats f : finfo ) { diff --git a/src/solrj/org/apache/solr/client/solrj/SolrQuery.java b/src/solrj/org/apache/solr/client/solrj/SolrQuery.java index 4d4faae7284..4618b5c98e3 100644 --- a/src/solrj/org/apache/solr/client/solrj/SolrQuery.java +++ b/src/solrj/org/apache/solr/client/solrj/SolrQuery.java @@ -352,11 +352,10 @@ public class SolrQuery extends ModifiableSolrParams this.set( StatsParams.STATS, v ); } - public void setGetFieldStatistics( String field, boolean twopass ) + public void setGetFieldStatistics( String field ) { this.set( StatsParams.STATS, true ); this.add( StatsParams.STATS_FIELD, field ); - this.set( "f."+field+"."+StatsParams.STATS_TWOPASS, twopass+"" ); } public void addStatsFieldFacets( String field, String ... facets ) diff --git a/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java b/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java index 2516160efa2..aa35c7d6ac4 100644 --- a/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java +++ b/src/solrj/org/apache/solr/client/solrj/response/FieldStatsInfo.java @@ -41,7 +41,6 @@ public class FieldStatsInfo implements Serializable { Double mean = null; Double sumOfSquares = null; Double stddev = null; - Double median = null; Map> facets; @@ -74,9 +73,6 @@ public class FieldStatsInfo implements Serializable { else if( "stddev".equals( entry.getKey() ) ) { stddev = (Double)entry.getValue(); } - else if( "median".equals( entry.getKey() ) ) { - median = (Double)entry.getValue(); - } else if( "facets".equals( entry.getKey() ) ) { NamedList fields = (NamedList)entry.getValue(); facets = new HashMap>(); @@ -119,9 +115,6 @@ public class FieldStatsInfo implements Serializable { if( mean != null ) { sb.append( " mean:").append( mean ); } - if( median != null ) { - sb.append( " median:").append(median); - } if( stddev != null ) { sb.append( " stddev:").append(stddev); } @@ -161,10 +154,6 @@ public class FieldStatsInfo implements Serializable { return stddev; } - public Double getMedian() { - return median; - } - public Map> getFacets() { return facets; } diff --git a/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index 032cefb43bf..23750f92562 100644 --- a/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -343,7 +343,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase SolrQuery query = new SolrQuery( "*:*" ); query.setRows( 0 ); - query.setGetFieldStatistics( "popularity", true ); + query.setGetFieldStatistics( "popularity" ); QueryResponse rsp = server.query( query ); FieldStatsInfo stats = rsp.getFieldStatsInfo().get( "popularity" ); @@ -353,7 +353,6 @@ abstract public class SolrExampleTests extends SolrExampleTestBase assertEquals( 94.0, stats.getMax() ); assertEquals( new Long(nums.length), stats.getCount() ); assertEquals( new Long(0), stats.getMissing() ); - assertEquals( (nums[4]+nums[5])/2.0, stats.getMedian() ); assertEquals( "26.4", stats.getStddev().toString().substring(0,4) ); // now lets try again with a new set... (odd median) @@ -380,7 +379,6 @@ abstract public class SolrExampleTests extends SolrExampleTestBase assertEquals( 20.0, stats.getMax() ); assertEquals( new Long(nums.length), stats.getCount() ); assertEquals( new Long(0), stats.getMissing() ); - assertEquals( 10.0, stats.getMedian() ); // Now try again with faceting //---------------------------------