Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinct Results from Solr Query [duplicate]

Tags:

solr

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

like image 894
Siva Avatar asked Aug 28 '13 10:08

Siva


1 Answers

Check grouping/field collapsing feature in SOLR

&q=solr+memory&group=true&group.field=manu_exact
like image 72
sidgate Avatar answered Jan 04 '23 11:01

sidgate