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 vit <bu...@yahoo.com> on 2015/01/19 18:40:14 UTC

Distinct Results from Solr Query

I am using Solr 4.2
In the ressults set we are getting documents with the same field value.
Is it possible to indicate in the query that we need results with distinct
value of this field?



--
View this message in context: http://lucene.472066.n3.nabble.com/Distinct-Results-from-Solr-Query-tp4180471.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Distinct Results from Solr Query

Posted by Jorge Luis Betancourt González <jl...@uci.cu>.
I think this sounds like grouping results by field?
You should enable groups by adding &group=true&group.field=YOURFIELD to test this feature.

For each unique value of the field specified in group.field, Solr returns a docList with the *top scoring document*. In the docList you can see the total number of matches in that group.

Hope it helps,

----- Original Message -----
From: "vit" <bu...@yahoo.com>
To: solr-user@lucene.apache.org
Sent: Monday, January 19, 2015 1:56:43 PM
Subject: Re: Distinct Results from Solr Query

In other words I need to pick only one document per the field value. 
Say I have a filed cat_id. For each value of this filed returned I need to
return only 1 document and I do not care which one.  



--
View this message in context: http://lucene.472066.n3.nabble.com/Distinct-Results-from-Solr-Query-tp4180471p4180483.html
Sent from the Solr - User mailing list archive at Nabble.com.


---------------------------------------------------
XII Aniversario de la creación de la Universidad de las Ciencias Informáticas. 12 años de historia junto a Fidel. 12 de diciembre de 2014.


Re: Distinct Results from Solr Query

Posted by vit <bu...@yahoo.com>.
In other words I need to pick only one document per the field value. 
Say I have a filed cat_id. For each value of this filed returned I need to
return only 1 document and I do not care which one.  



--
View this message in context: http://lucene.472066.n3.nabble.com/Distinct-Results-from-Solr-Query-tp4180471p4180483.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Distinct Results from Solr Query

Posted by Kydryavtsev Andrey <we...@yandex.ru>.
Sounds like you need to develop your own post filter collector. In this collector you can get value for your field cat_id by document id, store it in collection and filter out documents which values are presented in this collection.  It similar with http://lucidworks.com/blog/custom-security-filtering-in-solr/ , but other custom logic. 

20.01.2015, 00:25, "vit" <bu...@yahoo.com>:
> Unfortunately grouping will not work here since my field is multi-valued.
> So I need another solution.
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Distinct-Results-from-Solr-Query-tp4180471p4180499.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Distinct Results from Solr Query

Posted by vit <bu...@yahoo.com>.
Unfortunately grouping will not work here since my field is multi-valued. 
So I need another solution.



--
View this message in context: http://lucene.472066.n3.nabble.com/Distinct-Results-from-Solr-Query-tp4180471p4180499.html
Sent from the Solr - User mailing list archive at Nabble.com.