lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trejkaz <trej...@trypticon.org>
Subject Re: Grouping Clauses to Preserve Order of Boolean Precedence
Date Fri, 05 Aug 2011 01:10:32 GMT
On Fri, Aug 5, 2011 at 1:57 AM, Jim Swainston
<jimswainston@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message