lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: ORs and Ranks
Date Mon, 05 Jan 2009 19:46:46 GMT
As you say, your "real" queries are more complex, but your
example seems like a simple boost to me joined by an OR clause.


which you can construct in a BooleanQuery as two clauses
and "SHOULD".

The sense of this is that a hit must contain "CAT" in either
the MEDICAL or the ANIMAL fields, but occurrences in the
MEDICAL field will tend to sort to the top....

Remember too that Lucene query logic isn't strictly Boolean...


On Mon, Jan 5, 2009 at 2:33 PM, Walt Stoneburner <
> wrote:

> Got an interesting question about Lucene's behavior, as recently I was
> handed something that look like this:
>  ( +MEDICAL CAT^2 )  OR  ( +ANIMAL CAT^-2 )
> The intention of the query is to say "if medical is found, then rank cat
> [scans] high, but if animal is found then rank cat [a feline] low."
> Problem is my understanding of Lucene tells me that there really is no AND
> /
> OR set operations, and that instead Lucene has a REQUIRED, NOT_REQUIRED,
> SHOULD setting for each term. As such, one might be able to "simulate"
> certain kinds of AND/OR expressions, but that subexpression statements are
> independently isn't happening.
> Is my understanding correct, or will Lucene do this kind of magic?  The
> actual query I was given to construct programatically was significantly
> more
> complex.
> -wls

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