lucene-java-user mailing list archives

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

thanks for the tip.

However, I'm not sure, how can I implement with MaxDisjunctionQuery
the following:

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

(+(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))

If I'm wrong and this query can be simplified containing several
MaxDisjunctionQuery, it would be great.


Tuesday, October 25, 2005, 9:41:13 AM, you wrote:

CH> I may be wrong, but i think what you are talking about is a BooleanQuery
CH> containing several MaxDisjunctionQuery.  take a look at the code in this
CH> patch...


CH> : Date: Mon, 24 Oct 2005 20:13:55 +0300
CH> : From: Maxim Patramanskij <>
CH> : Reply-To:, Maxim Patramanskij <>
CH> : To:
CH> : Subject: Cross-field multi-word and query
CH> :
CH> :
CH> : I have the following problem:
CH> :
CH> : I need to construct programmatically a Boolean query against n fields
CH> : having m words in my query.
CH> :
CH> : All possible unique combinations(sub-queries) are disjunctive between
CH> : each other while boolean clauses of each combination combines with AND
CH> : operator.
CH> :
CH> : The reason of such complexity is that I have to find a result of AND
CH> : query against several field, when parts of my query could appear in
CH> : different fields and I can't create just one single field because each
CH> : field has its own boost level.
CH> :
CH> : Does anyone have an experience of writing such query builder?
CH> :
CH> : Best regards,
CH> :  Maxim
CH> :
CH> :
CH> : ---------------------------------------------------------------------
CH> : To unsubscribe, e-mail:
CH> : For additional commands, e-mail:
CH> :

CH> -Hoss

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

View raw message