@Binoy: The query does work but for one term (-persons:[* TO *]) but it does not work for multiple terms such as http://[Myserver]/solr/[Collection]/select?q=(-persons:[* TO *])AND(-orgs:[* TO *]) This returns zero records although I do have records that has both persons and orgs empty.
@Jack: Replacing (-persons:*)AND(-orgs:*) with (*:* -persons:*)AND(*:* -orgs:*) did the trick. Thanks. Thanks you both for your comments. Salman On Sun, Feb 14, 2016 at 7:51 PM, Jack Krupansky <jack.krupan...@gmail.com> wrote: > Due to a bug (or poorly designed feature), you need to explicitly include a > non-negative query term in a purely negative sub-query. Usually this means > using *:* to select all documents. Note that the use of parentheses > introduces a sub-query. So, (-persons:*) s.b. (*:* -persons:*). > > -- Jack Krupansky > > On Sun, Feb 14, 2016 at 8:21 AM, Salman Ansari <salman.rah...@gmail.com> > wrote: > > > Hi, > > > > I think what I am asking should be easy to do but for some reasons I am > > facing issues in making that happen. The issue is that I want > > include/exclude some fields from my Solr query. All the fields that I > need > > to include are multi valued int fields. When I include the fields I have > > the following query > > > > http:// > > > > > [MySolrServer]/solr/[Collection]/select?q=(persons:*)AND(places:*)AND(orgs:*) > > This does return the desired result. However, when I negate the values > > > > http:// > > > > > [MySolrServer]/solr/[Collection]/select?q=(-persons:*)AND(-places:*)AND(-orgs:*) > > This returns 0 documents although there are a lot of documents that have > > all those fields empty. > > > > Any ideas why this is happening? > > > > Appreciate any comments/feedback. > > > > Regards, > > Salman > > >