Hello,

The best/easiest/only way I can think of to handle this is to have
another field that serves as a flag.  You could add that field only
when your document has that optional field.
Actually, you may also be able to make use of the ability to add
multiple values to the same field.  Then you could pick some obscure
and/or reserved value for a field to serve as a marker.

Something along the lines of:

if (oh, this type of doc has field X) {
 doc.add(Field.UnStored("fieldName", "field value here"));
 doc.add(Field.UnStored("fieldName", "__flag"));
}

Then you can search for fieldName:__flag and you will find all
documents with "fieldName".

The choice of __flag may not be the best, but you can play with it and
see what works best for you.

Otis

--- jt oob <[EMAIL PROTECTED]> wrote:
> Is it possible/what's the best way, to find all documents which have
> a
> given field. The field contents may be the empty string "".
> 
> Thanks,
> jt
> 
> 
>       
>       
>               
> ___________________________________________________________ALL-NEW
> Yahoo! Messenger - sooooo many all-new ways to express yourself
> http://uk.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to