Thanks! That query example below worked for me! -----Original Message----- From: Jan Høydahl <jan....@cominvent.com> Sent: Thursday, April 17, 2025 3:11 PM To: users@solr.apache.org Subject: Re: Query syntax
Hi, You're running into corner cases of Lucene's pure negative query. Google and you'll find some articles. Try rewriting your query in a more explicit way, e.g. q=(*:* -attributename1:*) OR (*:* -attributename2:*) AND Class:Document Jan > 17. apr. 2025 kl. 20:05 skrev Farmerie, Henry > <henry.farme...@siemens.com.INVALID>: > > I'm observing the following behavior with Solr 9.7.0: > > Searching for attributes that are empty (have no value), I'm using the syntax > "-attributename1:*". > This query works correctly and returns many results (because attributename1 > is empty for many documents): > > http://hostname:8983/solr/solr1/select?q=-attributename1:*%20AND%20Class:Document&wt=xml&rows=10000 > > Whereas this query looking for either attributename1 OR attributename2 being > empty returns zero results: > > http://hostname:8983/solr/solr1/select?q=-attributename1:*%20OR%20-attributename2:*%20AND%20Class:Document&wt=xml&rows=10000 > > enclosing the first 2 attributes in parentheses doesn't change the behavior, > still zero results. > > http://hostname:8983/solr/solr1/select?q=(-attributename1:*%20OR%20-attributename2:*)%20AND%20Class:Document&wt=xml&rows=10000 > > Does anyone know why this is happening? It should be still returning the > results of attributename1 being empty. > > Henry Farmerie > > Siemens Product Lifecycle Management Software Inc. > Communications and Government Affairs > Lifecycle Coll > > Shoreview, MN 55126 United States > Fax :+1 (651) 855-6280 > henry.farme...@siemens.com <mailto:henry.farme...@siemens.com> >