You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by vinothkumar raman <vi...@gmail.com> on 2013/04/22 11:54:16 UTC

Stats facet on int/tint fields

I have a schema like this

<field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="cat" type="int" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="cat_name" type="int" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="price" type="tdouble" indexed="true" stored="true"
required="true" multiValued="false"/>

I wanted to find the average price faceted on cat. So was using the
stats facet to get the average on the fields like this
http://solr-serv/solr/latest/select?q=*%3A*&wt=xml&indent=true&stats=true&rows=0&stats.field=price&stats.facet=cat

Which throws an exception like this
org.apache.solr.common.SolrException: Server at
http://solr-serv/solr/latest returned non ok status:500,
message:Server Error at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:373)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:169)
at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:135)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

When i look at the logs this is all i get

null:java.lang.NumberFormatException: For input string: "`=?"


But when i try with stats.facet=cat_name it works perfectly fine. It
doesnt work with any other int/tint field

I am not sure whats really wrong with my query.

(Dropping it to dev list too. Incase if its a bug)


PS: Not sure if its bug so sending it to dev mailing list too.n

RE: Stats facet on int/tint fields

Posted by Michael Ryan <mr...@moreover.com>.
Sounds like this could be https://issues.apache.org/jira/browse/SOLR-2976.

-Michael

-----Original Message-----
From: vinothkumar raman [mailto:vinothkr.kkdi@gmail.com] 
Sent: Monday, April 22, 2013 5:54 AM
To: solr-user@lucene.apache.org; solr-dev@lucene.apache.org
Subject: Stats facet on int/tint fields

I have a schema like this

<field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="cat" type="int" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="cat_name" type="int" indexed="true" stored="true"
required="true" multiValued="false"/>
<field name="price" type="tdouble" indexed="true" stored="true"
required="true" multiValued="false"/>

I wanted to find the average price faceted on cat. So was using the stats facet to get the average on the fields like this http://solr-serv/solr/latest/select?q=*%3A*&wt=xml&indent=true&stats=true&rows=0&stats.field=price&stats.facet=cat

Which throws an exception like this
org.apache.solr.common.SolrException: Server at http://solr-serv/solr/latest returned non ok status:500, message:Server Error at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:373)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:169)
at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:135)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

When i look at the logs this is all i get

null:java.lang.NumberFormatException: For input string: "`=?"


But when i try with stats.facet=cat_name it works perfectly fine. It doesnt work with any other int/tint field

I am not sure whats really wrong with my query.

(Dropping it to dev list too. Incase if its a bug)


PS: Not sure if its bug so sending it to dev mailing list too.n