I'm constructing a search with some required terms and some optional
terms in in the query. According to some earlier posts that looks like
"+(A B) C D E" in query syntax for required terms A and B and optional
terms C D and E. In other words, Lucene considers all documents that
have both A and B, and ranks them higher if they also have C D or E.
I'm wondering how this translates to a BooleanQuery. I know I should use
BooleanClause.Occur.MUST for A and B, and I guess I should use
BooleanQuery.Occur.SHOULD for C, D and E. However the javadocs for
BooleanClause.Occur.SHOULD states:
"Use this operator for clauses that /should/ appear in the matching
documents. For a BooleanQuery with two |SHOULD| subqueries, at least one
of the clauses must appear in the matching documents."
Does this last sentence actually mean that a query with _just_ two
SHOULD clauses (ie. only SHOULD clauses) must contain one of the
clauses, or will the BooleanQuery described above actually constrain the
search results to (A AND B) AND (B OR C OR D)? If so, what should I use
instead?
thank you,
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]