: I want a query of the form:
:
: x AND ( a OR b OR c OR d)
what your code is currenlty doing is adding 5 term queries to a single
boolean query.
The structure you want is not a single boolean query, it's a boolean query
containing two mandatory clauses: the first being a term query, and the
second being a boolean query containing 4 optional clauses.
The fact that you needed parens to clearly express what you wanted is the
first tip off.
Another good way to udnerstand how to build a query progromatically like
this, is to try feeding your boolean expression to the query parser, and
then looking at the toString of the query it produces.
: The nearest I've managed to get is
...
: But this results in a query something similar to:
:
: x AND a OR b OR c OR d
Technically, i don't think the query you've created in your java code can
be represented using simple AND OR expressions ... that's why i hate
writing queries out that way, because lucene queries aren't simple boolean
logic constructs, they have scores and relevancy, the best way to describe
what your java code does is...
+x a b c d
...x is mandatory, all other terms are optional and increase the score.
what you want is...
+x +(a b c d)
...x is mandatory, at least one from the list of a, b, c, or d are
mandatory as well, and if more then one match the score is increased
accordingly.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]