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 Daniel Andersson <da...@polkabrothers.com> on 2008/05/07 00:43:22 UTC

Searching for empty fields

Hi (again)

One of the fields in my database is color. It can either contain a  
value (blue, red etc) or be blank. When I perform a search with facet  
counts on, I get a count for "_empty_".

How do I go about searching for this?

I've tried color:"" which gives me an error. Same with color:.  
color:_empty_ returns nothing at all.

Thanks in advance!

/ d

Re: Searching for empty fields

Posted by Chris Hostetter <ho...@fucit.org>.
: (*:* AND -color:[* TO *])

the *:* shouldn't be neccessary in Solr, fq=-color:[* TO *] should work just fine.

: > One of the fields in my database is color. It can either contain a value
: > (blue, red etc) or be blank. When I perform a search with facet counts on, I
: > get a count for "_empty_".

For the record, nothing in Solr's SimpleFacet code will produce the string 
"_empty_" ... if facet.missing=true then a count of all docs with no value 
will be included, but it doesn't have a label (ala hte example on the 
wiki....

 <lst name="facet_fields">
  <lst name="cat">
        <int name="music">1</int>
        <int name="connector">2</int>
        <int name="electronics">3</int>
        <int>1</int>   <!-- this is the facet.missing count -->
  </lst>



-Hoss


Re: Searching for empty fields

Posted by Erick Erickson <er...@gmail.com>.
the really simple way is to index "none" for fields that are empty then just
search on color:none.....



On Tue, May 6, 2008 at 9:06 PM, Brendan Grainger <br...@gmail.com>
wrote:

> Hi,
>
> Not sure if this is what you want, but to search for 'empty' fields we use
> something like this:
>
> (*:* AND -color:[* TO *])
>
> Hope that helps.
>
> Brendan
>
>
> On May 6, 2008, at 6:43 PM, Daniel Andersson wrote:
>
>  Hi (again)
> >
> > One of the fields in my database is color. It can either contain a value
> > (blue, red etc) or be blank. When I perform a search with facet counts on, I
> > get a count for "_empty_".
> >
> > How do I go about searching for this?
> >
> > I've tried color:"" which gives me an error. Same with color:.
> > color:_empty_ returns nothing at all.
> >
> > Thanks in advance!
> >
> > / d
> >
>
>

Re: Searching for empty fields

Posted by Brendan Grainger <br...@gmail.com>.
Hi,

Not sure if this is what you want, but to search for 'empty' fields we  
use something like this:

(*:* AND -color:[* TO *])

Hope that helps.

Brendan

On May 6, 2008, at 6:43 PM, Daniel Andersson wrote:

> Hi (again)
>
> One of the fields in my database is color. It can either contain a  
> value (blue, red etc) or be blank. When I perform a search with  
> facet counts on, I get a count for "_empty_".
>
> How do I go about searching for this?
>
> I've tried color:"" which gives me an error. Same with color:.  
> color:_empty_ returns nothing at all.
>
> Thanks in advance!
>
> / d