List Info

Thread: Updated: (LUCENE-72) Query parser inconsistency when using terms to exclude.




Updated: (LUCENE-72) Query parser inconsistency when using terms to exclude.
user name
2006-08-29 06:00:24
     [ http://issues.apache.org/jira/browse/LUCENE-72?page=all ]

Dejan Nenov updated LUCENE-72:
------------------------------

    Attachment: TestRegressionLucene72.java

This issue was so old that I wanted to verify thatit still
exists.
The attached test is specific to the issue and indeed shows
that

+(fruits vegetables) AND (-tomatoes -bananas)

does not perform as expected.

I use
"QueryParser.setDefaultOperator(QueryParser.OR_OPERATO
R)"
and I setup 4 documents:

Doc1 = fruits vegetables tomatoes bananas
Doc2 = fruits vegetables tomatoes kiwis
Doc3 = fruits vegetables peppers kiwis
Doc4 = fruits vegetables peppers bananas

My expectations is to get docs 2,3,4 - instead the query
returns no hits.

Somebody please check that this makes sense.

I have not run this test with the attached patches applied,
however - I decided to not spend the time applying 2 year
old patches to the current release 

> [PATCH] Query parser inconsistency when using terms to
exclude.
>
------------------------------------------------------------
---
>
>                 Key: LUCENE-72
>                 URL: http:/
/issues.apache.org/jira/browse/LUCENE-72
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: QueryParser
>    Affects Versions: 1.2
>         Environment: Operating System: All
> Platform: PC
>            Reporter: Carlos
>         Assigned To: Lucene Developers
>         Attachments: patch6.txt, patch7.txt,
TestRegressionLucene72.java
>
>
> Hi.
> The problem I am having occurs when using queryparser
and also when building the
> query using the API.
> Assume that we want to look for documents about fruits
or vegetables but 
> excluding tomatoes and bananas. I suppose the right
query sould be:
> +(fruits vegetables) AND (-tomatoes -bananas)
> wich I think is equivalent to (if tou parse it and then
print the query.toString
> ("") result that is what you get)
> +(fruits vegetables) +(-tomatoes -bananas)
> but the query doesn't work as expected, in fact the
query that works is
> +(fruits vegetables) -(-tomatoes -bananas)
> which doesn´t really make much sense, because the
second part seems to say:
> All documents where the condition "tomatoes is
not present and bananas is not 
> present " is false, which means the opposite.
> In fact, second query works as (even if they look quite
opposite):
> +(fruits vegetables) -tomatoes -bananas
> Hope someone could help, thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the
administrators: http://issues.apache.org/jira/secure/Administrators.jspa

-
For more information on JIRA, see: http://www.atl
assian.com/software/jira

       

------------------------------------------------------------
---------
To unsubscribe, e-mail: java-dev-unsubscribelucene.apache.org
For additional commands, e-mail: java-dev-helplucene.apache.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )