I believe there isn't. I don't think any of the existing QueryParsers
implements "search empty field" expression.
The way you might solve this requirement is to use a special "empty term"
for such fields. For instance, I use single underscore "_" as a value for
all empty fields in the document. I also use Keyword field to store this
value verbatim (avoid Analyser that might not want to index a single
underscore).
Searching for "empty term" can then be performed programmaticaly with a
TermQuery:
indexSearcher.Search(new TermQuery(new Term("author", "_")));
General guide for the "empty term" value would be to choose a term that does
not occur in any text you put into your index.
On Apr 9, 2005 12:44 AM, Bruce Best (CRO) <[EMAIL PROTECTED]> wrote:
> Is there any syntax to find all the documents where a particular
> Lucene-indexed field is empty?
>
> For instance, say there is a field called "author". I can do a field
search
> for
> author:cutting
> to find all documents with "cutting" in the author field; I could also
> search for
> author:"*"
> which would return all documents, whether there was something in the
author
> field or not.
>
> What if I wanted to find all those documents that had nothing at all in
the
> "author" field? I tried a few combinations of wildcards and other various
> Lucene symbols, but they generally resulted in errors.
>
> Is it possible with Lucene to specify "Return all documents where fieldx:
is
> empty"?
>
> Thanks,
>
> B.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>