lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Weird operator precedence with default operator AND
Date Wed, 10 Oct 2007 12:03:15 GMT
There is a lot on this topic if you search the archives.

Things to check out:

Precedence QueryParser (I think its in Lucene contrib packages - I don't 
believe its perfect but I have not tried it)

Qsol: myhardshadow.com/qsol (A query parser I wrote that has fully 
customizable precedence support - don't be fooled by the stale 
website...I am actually working on version 2 as i have time)

- Mark

Martin Dietze wrote:
> Hi,
>
>  I've been going nuts trying to use LuceneParser parse query
> strings using the default operator AND correctly:
>
> String queryString = getQueryString();
> QueryParser parser = new QueryParser("text", new StandardAnalyzer());
> parser.setDefaultOperator(QueryParser.AND_OPERATOR);
> try {
>   Query q = parser.parse(queryString);
>   LOG.info("q: " + q.toString());
>   /* [...] */
>
> Here's two example queries and the results I get with and
> without the `setDefaultOperator()' statetment:
>
> Query: hose AND cat:Wohnen cat:Mode OR color:blau
>
> - Default-Op OR:  (+text:hose +cat:Wohnen) cat:Mode color:blau
> - Default-Op AND: +(+text:hose +cat:Wohnen) cat:Mode color:blau
>
> Query: hose AND ( cat:Wohnen cat:Mode ) OR color:blau
>
> - Default-Op OR:  (+text:hose +(cat:Wohnen cat:Mode)) color:blau
> - Default-Op AND: (+text:hose +(+cat:Wohnen +cat:Mode)) color:blau
>
> It seems like theparser handles the default case well, but what
> I get with the default operator set to AND is completely
> incorrect. I've seen this behaviour with both version 2.1.0 and
> 2.2.0.
>
> Any hints?
>
> Cheers,
>
> Martin
>
>   

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