You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Bill Tschumy <bi...@otherwise.com> on 2004/07/19 23:42:21 UTC

Misbehaving query string

I would think the following strings passed to the QueryParser should 
yield the same results:

#1:   +telescope AND !operate

#2:   (+telescope) AND (!operate)

However the first string seems to give the correct results while the 
second gives "zero" hits.  Am I misunderstanding something or is there 
a bug?
-- 
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Misbehaving query string

Posted by Morus Walter <mo...@tanto.de>.
Bill Tschumy writes:
> I would think the following strings passed to the QueryParser should 
> yield the same results:
> 
> #1:   +telescope AND !operate
> 
> #2:   (+telescope) AND (!operate)
> 
> However the first string seems to give the correct results while the 
> second gives "zero" hits.  Am I misunderstanding something or is there 
> a bug?

The first query creates a boolean query with a required and a prohibited term.
The second one, creates one boolean query for the !operate term, containing
only one prohibited term and combines this with a query for telescope where
both subqueries are required (don't ask me, if telescope makes a term query
or a boolean query, I suspect the former).
But lucene doesn't search boolean queries only containing prohibited terms.
So the !operate boolean query gives you an empty result, which leads to the
empty result of the whole query.

I don't know if there's a reason, why the boolean query doesn't throw an
exception in this case. Silently not working doesn't seem a good way of 
handling this.

Morus

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org