lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: query syntax question
Date Thu, 10 May 2007 13:02:34 GMT
You could create a Lucene Filter that had a bit for each document that
had a first or last name and use that at query time to restrict your
results appropriately. You could create this at startup time or at
query time. See CachingWrapperFilter for a way to cache it.

Another approach would be to add a dummy field to each document,
something like HASFIRSTORLASTNAME. At index time, when
you index a document, if it has a first or last name, put "yes" in the
field. Otherwise, put "no".

Then, at search time, add an +HASFIRSTORLASTNAME:yes to the

You could add as many states to this field as you want.


On 5/10/07, Les Fletcher <> wrote:
> I have a question about empty fields.  I want to run a query that will
> search against a few particular fields for the query term but then also
> also check to see if a two other fields have any value at all.  i.e., I
> want to search for a set records but don't want to return a record if
> that record has blank first and last name fields.  Any help would be
> greatly appreciated.
> Les
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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