On 8/18/2014 12:47 PM, tedsolr wrote: > Hi. I have a query that works just fine in the browser. It rolls up documents > by the facet field and gives me stats on the stats field: > > http://localhost:8983/solr/corename/select?q=*:*&stats=on&stats.field=Spend&stats.facet=Supplier > > Posting this works just fine. However I cannot get stats from SolrJ or the > solr admin console. From the admin console (on the Query tab) I see: > <str name="msg">can not use FieldCache on a field which is neither indexed > nor has doc values: Supplier?wt=xml</str> > > Both Spend and Supplier are indexed. The error must be referring to > something else. > > In Java, I use > query.addStatsFieldFacets("Spend", "Supplier"); > but the stats object comes back null. > response.getFieldStatsInfo() == null
I won't claim to know how the stats stuff works, but one thing to do is make sure Solr is logging at the INFO level or finer, then look at the Solr log to see what the differences are in the actual query that Solr is receiving when you do it in the browser and when you do it with SolrJ. You will need to look at the actual log file, not the logging tab in the admin UI. When using the example included in the Solr download, the logfile is at logs/solr.log. If you're using another method for starting Solr, that may be different. Thanks, Shawn