lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <mkhlud...@griddynamics.com>
Subject Re: short-circuit OR operator in lucene/solr
Date Mon, 22 Jul 2013 08:17:23 GMT
Short answer, no - it has zero sense.

But after some thinking, it can make some sense, potentially.
DisjunctionSumScorer holds child scorers semi-ordered in a binary heap.
Hypothetically inequality can be enforced at that heap, but heap might not
work anymore for such alignment. Hence, instead of heap TreeSet can be used
for experiment.
fwiw, it's a dev list question.


On Mon, Jul 22, 2013 at 4:48 AM, Deepak Konidena <deepakkoni@gmail.com>wrote:

> I understand that lucene's AND (&&), OR (||) and NOT (!) operators are
> shorthands for REQUIRED, OPTIONAL and EXCLUDE respectively, which is why
> one can't treat them as boolean operators (adhering to boolean algebra).
>
> I have been trying to construct a simple OR expression, as follows
>
> q = +(field1:value1 OR field2:value2)
>
> with a match on either field1 or field2. But since the OR is merely an
> optional, documents where both field1:value1 and field2:value2 are matched,
> the query returns a score resulting in a match on both the clauses.
>
> How do I enforce short-circuiting in this context? In other words, how to
> implement short-circuiting as in boolean algebra where an expression A || B
> || C returns true if A is true without even looking into whether B or C
> could be true.
> -Deepak
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mkhludnev@griddynamics.com>

Mime
View raw message