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 syntax French Operator
Date Wed, 04 Oct 2006 10:49:34 GMT

On Oct 4, 2006, at 2:18 AM, Ronnie Kolehmainen wrote:

> Wouldn't the easiest fix be to just alter the users query string  
> before passing
> it to queryparser (moving the semantics of your search app outside  
> of lucene)?
> Something like:
>
> str.replaceAll(" ET ", " AND ").replaceAll(" OU ", " OR  
> ").replaceAll(" SAUF ",
> " NOT ")

The problem would be in cases where the users query was:

	title:"SANFORD AND SON" OR genre:comedy





>
>
> Citerar Mark Miller <markrmiller@gmail.com>:
>
>> Oh wouldn't we all. I want this too. Unfortunately, it's an elusive
>> beast at best. As I am sure you know, JavaCC generates code based  
>> on the
>> grammar and so it is very hard to alter the grammar after  
>> JavaCC'ing it.
>> If you relax the 'add' part then you might be able to do something  
>> with
>> QueryParserConstants.java. This holds an int for each string in the
>> grammar which indexes into a String array...check it out and you will
>> see what I mean. So replacing may be as easy as modifying the  
>> 'and' and
>> 'or' and whatnot in that String array. You might make a conditional
>> build file that includes the correct QueryParserConstants.java or
>> something. I have not explored this too deeply so if you find  
>> something
>> better or this is a dead end, please let me know.
>>
>> - Mark
>>
>> Patrick Turcotte wrote:
>>> Hi,
>>>
>>> Is there a way to add / replace the text for the boolean  
>>> operators used
>>> by the query parser?
>>>
>>> We would like to replace (or even better, add), "AND", "OR" and  
>>> "NOT" by
>>> "ET", "OU" and "SAUF".
>>>
>>> Is there a way to configure the QueryParser to do it?
>>>
>>> We know we could always modify QueryParser.jj to add them to the  
>>> list,
>>> but we'd rather like not to have to recompile/rejar each time  
>>> there is a
>>> new version of Lucene.
>>>
>>> Thanks
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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