Okay I try to specify my question a little bit. I have a denormalized index of two sql tables patient and table.
If I add a patient with two images to the solr index my index contains 3 documents. ------------------------------------------- Pat_ID |Patient_Lastnname | Image_ID | Image_Name ------------------------------------------- 1 | Miller | EMPTY| EMPTY 1 | Miller | 1 | dog.jpg 1 | Miller | 2 | cat.jpg ------------------------------------------- When I add now another patient without any images the solr index contains 4 documents. ------------------------------------------- Pat_ID |Patient_Lastnname | Image_ID | Image_Name ------------------------------------------- 1 | Miller | EMPTY| EMPTY 1 | Miller | 1 | dog.jpg 1 | Miller | 1 | cat.jpg 2 | Smith | EMPTY| EMPTY ------------------------------------------- Now I want to select all patients that have no image. (image_id is empty) If I query this with the following solr query the result would be Miller and Smith but I need a query that will return Smith only. select?q=-Image_ID:[0 TO *] and then group by pat_id What I would need is something like the having clause in sql. So I could group by pat_id and filter for the one where count is less then 2 Bests Sandro -- View this message in context: http://lucene.472066.n3.nabble.com/Search-for-non-empty-fields-in-a-index-with-denormalized-tables-tp4093287p4093903.html Sent from the Solr - User mailing list archive at Nabble.com.