lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: QueryParser refactoring
Date Tue, 08 Mar 2005 13:26:25 GMT
On Mar 8, 2005, at 4:11 AM, sergiu gordea wrote:
> In our project I save search strings, generated with query.toString in 
> the database and I reconstruct the Query at runtime.
> I would appreciate if the  new QueryParser will pass the following 
> assert:
>
> Query query = QueryParser.parse(queryString, analyzer);
> Query query2 =  QueryParser.parse(query.toString(), analyzer);
> assertEquals(query.toString(), query2.toString());
>
> I think this might be a usefull test case ....

I agree that this is a nice ideal, but it is unrealistic in the general 
sense.  A custom analyzer could easily break this.  I suspect there are 
other cases where this would break even with a plain SimpleAnalyzer.

>>> Ok.
>>> The question how to handle BooleanQueries, that contain prohibited 
>>> terms
>>> only, is a question on it's own.
>>> In my fix I choose to silently drop these queries. Basically because 
>>> it's
>>> effectivly dropped during querying anyway.
>>
>>
>> Silently drop as in you removed them entirely from the resultant 
>> Query?
>>
>> That'd be easy enough to add - but is that what we want to happen?  
>> Community, thoughts?
>
> In my oppinion is better to throw a RuntimeException, something like 
> ...
> throw new ParseException("The query must contain at least one allowed 
> term. Full prohibited term queries are not allowed");

Ok, I think this could be done.

	Erik


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