Lal
Lal

Reputation: 1

Solr velocity UI - Facets query for unique value.

I do have a requirement to get unique facet counts based on a indexed field in Solr velocity UI. It seems there is a json option to get unique facet counts. Can this be used in solrconfig.xml

Here is what I tried.(From requestHandler section)

   <str name="facet">on</str>
   <str name="facet.missing">false</str>
   <str name="facet.field">State</str> 
   <str name="facet.query">State:&json.facet={ x : "unique(State)" }</str>

This throws errors.

Is there any other way to get the unique values?

thanks,

Upvotes: 0

Views: 284

Answers (1)

Vinod
Vinod

Reputation: 1953

Add facet in the solr request URL &json.facet={x : "unique(manu_exact)"}

example:

http://localhost:8983/solr/collection1/select?indent=on&q=*:*&wt=json&json.facet={x : "unique(manu_exact)"}

change collection name accordingly, you can see facets count at the bottom.

where count: is count of all facets. x: is unique value count of facets.

Upvotes: 0

Related Questions