But the query parser doesn't seem to do that for me with the input Marketing
AND Smith OR Davies. The query parser gives me 3 clauses. 1 must clause for
the term Marketing, 1 must clause for the term smith and 1 should clause for
the term Davies. e.g. +Marketing +Smith SHOULD Davies. What I would like the
query parser to be doing is recognising the order of Boolean precedence so
that it automatically gives me the nested query you describe e.g. SHOULD
(+Marketing +Smith) SHOULD Davies.

If Lucene can't do this does anyone know of any algorithms for generating
these nested queries so that they follow the order of Boolean precedence?

On 4 August 2011 02:05, Chris Hostetter <hossman_luc...@fucit.org> wrote:

>
> : Thanks Ian. How would you achieve the logic of the below query using
> : BooleanQuery and BooleanClause.occur? How would you achieve the grouping
> : effect?
> :
> : (Marketing AND Smith) OR Davies
>
> The same way the query parser does: that's a BooleanQuery (A) with two
> "SHOULD" clauses, the first of which is a nested BooleanQuery (B) (with
> two "MUST" clauses (X child of B) Marketing, and (Y child of B) Smith),
> and the 2nd of which (C, child of A) is a query for Davies.
>
>
> -Hoss
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

Reply via email to