On 8/9/07, Pieter Berkel <[EMAIL PROTECTED]> wrote:
> From an theoretical IR standpoint, there is no reason to index null values,
> or even empty strings for that matter.  However in practice there are plenty
> of cases that I've encountered where it is necessary to obtain a list of
> documents where a particular field is null (i.e. hasn't been specified at
> index time) or an empty string.
>
> For example, you may need to generate a list of products contained in your
> index that do not have a part number.  A dirty, ugly hack work-around to
> this problem that we've used in the past is to replace null or unset values
> at index time with a special token value like "__null__" that (hopefully)
> won't appear in normal indexed data.

A null field (meaning no value) can be indexed by leaving it out, and
searched with a negative filter or query clause:
-field:[* TO *]

-Yonik

Reply via email to