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 Mat Brown <ma...@patch.com> on 2010/07/15 00:09:15 UTC

Less convoluted way to query for an empty string?

Hi all,

I can't seem to find a way to query for an empty string that is
simpler than this:

field_name:[* to ""]

Things that don't work:

field_name:""
field_name["" TO ""]

Is the one I'm using the simplest option? If so, is there a particular
reason the other ones I mention don't work? Just curious mostly.

Thanks!
Mat

Re: Less convoluted way to query for an empty string?

Posted by Lukas Kahwe Smith <ml...@pooteeweet.org>.
On 15.07.2010, at 00:09, Mat Brown wrote:

> Hi all,
> 
> I can't seem to find a way to query for an empty string that is
> simpler than this:
> 
> field_name:[* to ""]
> 
> Things that don't work:
> 
> field_name:""
> field_name["" TO ""]
> 
> Is the one I'm using the simplest option? If so, is there a particular
> reason the other ones I mention don't work? Just curious mostly.
> 

Yomik recently suggested:
Hmmm, if this is on a String field, it seemed to work for me.
http://localhost:8983/solr/select?debugQuery=on&q=foo_s:""

The raw query parser would also work (it skips analysis):
http://localhost:8983/solr/select?debugQuery=on&q={!raw f=foo_s}

regards,
Lukas Kahwe Smith
mls@pooteeweet.org