On Fri, Aug 5, 2011 at 1:57 AM, Jim Swainston
<jimswains...@googlemail.com> wrote:
> So if the Text input is:
>
> Marketing AND Smith OR Davies
>
> I want my program to work out that this should be grouped as the following
> (as AND has higher precedence than OR):
>
> (Marketing AND Smith) OR Davies.
>
> I'm effectively looking for an algorithm that will properly group any number
> of terms......

Have you tried using PrecedenceQueryParser instead of the standard one?

http://lucene.apache.org/java/3_3_0/api/all/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.html

It probably does the right thing.

(Related but not part of the answer: I solved the issue here by making
it a parser-level feature, since I was making my own parser anyway.
When we get the AST from the parser, the precedence has already been
figured out.)

TX

---------------------------------------------------------------------
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