lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re[2]: Cross-field multi-word and query
Date Tue, 25 Oct 2005 21:23:39 GMT

: I have n fields, for simplicity let's say 3: f1, f2, f3.
: I have an AND query with m words in it, lets' also simplify: w1, w2, w3.
: To cover all possible cases I should finally have the following
: BooleanQuery:

it really depends on what you want.  if I understand what you mean in the
below query (I'm assuming you want all of those boolean queries to
themselves be optional clauses in one big wrapping BooleanQuery) then I
think you can acomplish roughly the same thing using one boolean query
wrapping a MaxDisjunct query for each word (where each unique clause of a
MaxDisjunct is for the different fields.

Expressed in the syntax used by Chuck Willians (the author of
MaxDisjunctQuery), what I mean is...

( +(f1:w1 | f2:w1 | f3:w1) +(f1:w2 | f2:w2 | f3:w2) +(f1:w3 | f2:w3 | f3:w3))

...this will garuntee that all three words appear in your index, in one of
hte three fields.  it will also result in the score contribution for each
word being dominated by on whichever field results in a Term that
generates the highest score for that word.

Please look at the "albino elephant" example provided by the Chuck in his
initial issue report...

: (+(f1:w1) +(f1:w2) +(f1:w3))
: (+(f2:w1) +(f2:w2) +(f2:w3))
: (+(f3:w1) +(f3:w2) +(f3:w3))
: (+(f1:w1) +(f2:w2) +(f3:w3))
: (+(f1:w2) +(f2:w1) +(f3:w3))
: (+ f1:w3) +(f2:w1) +(f3:w2))
: (+(f1:w1) +(f2:w3) +(f3:w2))
: (+(f1:w2) +(f2:w3) +(f3:w1))
: (+ f1:w3) +(f2:w2) +(f3:w1))
: (+(f1:w1) +(f1:w2) +(f2:w3))
: (+(f1:w1) +(f1:w2) +(f3:w3))
: (+(f1:w1) +(f1:w3) +(f2:w2))
: (+(f1:w1) +(f1:w3) +(f3:w2))
: (+(f1:w2) +(f1:w3) +(f2:w1))
: (+(f1:w2) +(f1:w3) +(f3:w1))
: (+(f2:w1) +(f2:w2) +(f1:w3))
: (+(f2:w1) +(f2:w2) +(f3:w3))
: (+(f2:w1) +(f2:w3) +(f1:w2))
: (+(f2:w1) +(f2:w3) +(f3:w2))
: (+(f2:w2) +(f2:w3) +(f1:w1))
: (+(f2:w2) +(f2:w3) +(f3:w1))
: (+(f3:w1) +(f3:w2) +(f1:w3))
: (+(f3:w1) +(f3:w2) +(f2:w3))
: (+(f3:w1) +(f3:w3) +(f1:w2))
: (+(f3:w1) +(f3:w3) +(f2:w2))
: (+(f3:w2) +(f3:w3) +(f1:w1))
: (+(f3:w2) +(f3:w3) +(f2:w1))


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message