5

I have the solr indexed data as below

<doc>
  <str name="pincode">792056</str>
  <str name="city">Bijoypur-I Bl.I -III</str>
  <str name="district">Changlang</str>
  <str name="locality">Bijoypur-I Bl.I -III</str>
  <str name="state">Arunachal Pradesh</str>
</doc>

My problem is for 10 distinct pincodes from the same state i have 10 documents and when i query for the states using the query http://ip:port/solr/select?q=state:Arunachal Pradesh it returns 10 values with the same state name, But i need the distinct values of state name only, Please help me on this

Siva
  • 1,938
  • 1
  • 17
  • 36

2 Answers2

8

Check grouping/field collapsing feature in SOLR

&q=solr+memory&group=true&group.field=manu_exact
sidgate
  • 14,650
  • 11
  • 68
  • 119
5

Is a facet query what you're after? This should get you a list of states with the number of docs per state:

http://ip:port/solr/select?q=*:*&rows=0&facet=true&facet.limit=-1&facet.field=state

Maybe describe exactly what the desired result is.

rainkinz
  • 10,082
  • 5
  • 45
  • 73
  • thanks for the reply, i tried the facet it is working but actually what i need is grouping – Siva Aug 29 '13 at 05:02