lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: searching for empty field
Date Mon, 11 Jun 2007 13:59:29 GMT
You don't as far as I know. One solution that has been suggested is
to always index field2, but with a noop value. This works pretty well
if you choose a value you'd never search for, say xzxzxzxzxzxzxzx.
Then you can search field2 for that special value to get the *empty*
case.

Best
Erick

On 6/11/07, Dino <dckorah@gmail.com> wrote:
>
> Hi Everyone,
>
> I have a lucene index were I add a document with a set of metadata. In my
> system, all the fields in the metadata set needn't be there all the time
> for
> a given document.
>
> Say if I am expecting a metadata set like
>         Field1:{yes|no}
>         [Field2:{val_1[,val_2]... }]
>         Field3:val_X
>
>
> Here the Field2 is the one that I am having trouble with.
>
> Currently when I get a document with a bunch of Field:Value metadata, I
> run
> them in a loop and create Field object relying on the metadata input. That
> way the data source decides the number of fields attached to a particular
> document. Fields like Field2 will be left out if it didn't appear in the
> input.
>
> So if I get a document like
>
>         Field1:yes
>         Field3:val_X
>         ~~~~~~~~~~~~~~~~~~~
>         DATA DATA DATA DATA ..... DATA
>
> The document in the index wouldn't have field2 attached to it.
>
> Now my question is how will I search for all the documents with *empty*
> Field2?
>
> Cheerio
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message