Thank you Johannes, but I want the documents having the field empty to be included in the results, just not to be grouped together, and if I understood your solution correctly, it will simply remove those documents from the results (Note : The field values are very variable and unknown to me).

On 02/22/2013 02:53 PM, Johannes Rodenwald wrote:
Hi Oussama,

If you have only a few distinct, unchanging values in the field that you group upon, you 
could implement a FilterQuery (query parameter "fq") and add it to the query, 
allowing all valid values, but not an empty field. For example:

fq=my_grouping_string_field:( value_a OR value_b OR value_c OR value_d )

If you use SOLR 4.x, you should be able to group upon an integer field, 
allowing a range filter:
(I still work with 3.6 which can only group on string fields, so i didnt test 
this one)

fq=my_grouping_integer_field:[1 TO *]

--
Johannes Rodenwald


----- Ursprüngliche Mail -----
Von: "Oussama Jilal" <jilal.ouss...@gmail.com>
An: solr-user@lucene.apache.org
Gesendet: Freitag, 22. Februar 2013 12:32:13
Betreff: Solr Grouping and empty fields

Hi,

I need to group some results in solr based on a field, but I don't want
documents having that field empty to be grouped together, does anyone
know how to achieve that ?


--
Oussama Jilal

Reply via email to