You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Erik Hatcher <er...@ehatchersolutions.com> on 2007/02/05 18:14:29 UTC

facet.missing broken in JSON writer

With the example application and data, this causes an exception (just  
adding &wt=json to an example from the facet wiki page):

<http://localhost:8983/solr/select? 
q=ipod&rows=0&facet=true&facet.limit=-1&facet.field=cat&f.cat.facet.miss 
ing=true&facet.mincount=1&facet.field=inStock&wt=json>

SEVERE: java.lang.NullPointerException
         at org.apache.solr.request.JSONWriter.writeStr 
(JSONResponseWriter.java:469)

This works in XML because it writes <int>0</int>.  Didn't it use to  
write out <int name="">0</int>?

I'm ok with a null/nil value being written out as '' for my cases.   
I'll fix it up locally and report back.

	Erik


Re: facet.missing broken in JSON writer

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
thanks!!!


On Feb 5, 2007, at 1:23 PM, Yonik Seeley wrote:

> On 2/5/07, Erik Hatcher <er...@ehatchersolutions.com> wrote:
>> With the example application and data, this causes an exception (just
>> adding &wt=json to an example from the facet wiki page):
>
> Fixed. It was a bug in the new json.nl=flat format.  A null key is  
> now written
> as a null.
>
> http://localhost:8983/solr/select? 
> q=ipod&rows=0&facet=true&facet.limit=-1&facet.field=cat&f.cat.facet.mi 
> ssing=true&facet.mincount=1&facet.field=inStock&wt=json&indent=on
>
> {
> "responseHeader":{
>  "status":0,
>  "QTime":140,
>  "params":{
> 	"wt":"json",
> 	"facet.limit":"-1",
> 	"rows":"0",
> 	"facet":"true",
> 	"facet.field":[
> 	 "cat",
> 	 "inStock"],
> 	"f.cat.facet.missing":"true",
> 	"facet.mincount":"1",
> 	"indent":"on",
> 	"q":"ipod"}},
> "response":{"numFound":3,"start":0,"docs":[]
> },
> "facet_counts":{
>  "facet_queries":{},
>  "facet_fields":{
> 	"cat":[
> 	 "connector",2,
> 	 "electronics",3,
> 	 "music",1,
> 	 null,0],
> 	"inStock":[
> 	 "false",2,
> 	 "true",1]}}}
>
> -Yonik


Re: facet.missing broken in JSON writer

Posted by Yonik Seeley <yo...@apache.org>.
On 2/5/07, Erik Hatcher <er...@ehatchersolutions.com> wrote:
> With the example application and data, this causes an exception (just
> adding &wt=json to an example from the facet wiki page):

Fixed. It was a bug in the new json.nl=flat format.  A null key is now written
as a null.

http://localhost:8983/solr/select?q=ipod&rows=0&facet=true&facet.limit=-1&facet.field=cat&f.cat.facet.missing=true&facet.mincount=1&facet.field=inStock&wt=json&indent=on

{
 "responseHeader":{
  "status":0,
  "QTime":140,
  "params":{
	"wt":"json",
	"facet.limit":"-1",
	"rows":"0",
	"facet":"true",
	"facet.field":[
	 "cat",
	 "inStock"],
	"f.cat.facet.missing":"true",
	"facet.mincount":"1",
	"indent":"on",
	"q":"ipod"}},
 "response":{"numFound":3,"start":0,"docs":[]
 },
 "facet_counts":{
  "facet_queries":{},
  "facet_fields":{
	"cat":[
	 "connector",2,
	 "electronics",3,
	 "music",1,
	 null,0],
	"inStock":[
	 "false",2,
	 "true",1]}}}

-Yonik