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 ") Citerar Mark Miller <[EMAIL PROTECTED]>: > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]