[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: QueryParser refactoring
From:       Erik Hatcher <erik () ehatchersolutions ! com>
Date:       2005-03-08 13:26:25
Message-ID: 2560924319c84bba6d75f6e246792f40 () ehatchersolutions ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic