You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Maxim Patramanskij <ma...@osua.de> on 2005/10/26 16:41:32 UTC

Re[3]: Cross-field multi-word and query

Hello Chris,

Thanks a lot for the helping hand.

I plugged in MaxDisjunctQuery and it is working so far, but I
need to check accuracy of it. Next problem I met is highlighter, which
must be adopted to understand MaxDisjunctQuery(because now it stops to
highlight anything due to unknown new Query type), but this is yet
another story :).

Greetings,
Max



Wednesday, October 26, 2005, 12:23:39 AM, you wrote:


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

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

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

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

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

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

CH>         http://issues.apache.org/jira/browse/LUCENE-323

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


CH> -Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org