lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Questions regarding Lucene query syntax
Date Sun, 06 May 2007 14:39:16 GMT
See below...

On 5/5/07, Daniel Einspanjer <> wrote:
> The query syntax reference page talks about the NOT and the - operators,
> but
> it wasn't clear to me what exactly the difference is between them.  Could
> someone tell me briefly what that difference might be or point me at some
> further docs that describe it?

See the thread "Standard Parser Behavior". It has several explications
of what the Lucene query syntax is all about. This confuses everybody,
so I think that thread will help you a lot.

Also, see

Is there a way to require a portion of a query only if there are values for
> that field in the document?
> e.g. If I know that I only want to match movies made between 1973 and
> 1975,
> I would like to be able to say in my query that if the document has a
> year,
> it must be in that range, but if the document has no year at all, don't
> fail
> the document for that reason alone.
> This is also important in the director name part.  If a document has a
> director given, and it doesn't match what I'm searching for, that should
> be
> a fail, but if the document has no director field, I don't want to fail
> the
> document for that reason alone.

You'll have to include a dummy value I think. Remember that you're
searching for stuff with Lucene, so saying "match even if there's
nothing there" is, er, ABnormal..

I'd think about putting a dummy value in those fields you want to handle
this way. For instance, add "matchall" to documents with no date. Then
you'd need to add an 'or date:matchall' clause to all the dates you query
on. Make sure it's a value that behaves reasonably when you want to
include all dates, or all dates before ####, or all dates after ####.


> Thanks,
> Daniel

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