[ http://issues.apache.org/jira/browse/LUCENE-682?page=all ]

Patrick Turcotte updated LUCENE-682:
------------------------------------

    Attachment: LocalizedQueryParser.zip

New versions. All in the zip file. Improvements are:

- By default, if used, using a localized version disable English tokens (AND, 
NOT, OR)
- More than one operator may be define in the bundle (separated by ';')
- &&, || and ! operators are always active.

A note on ResourceBundle, as I had to do some test to understand the 
documentation:

1) getStringArray() is really just a wrapper on (String[]) getObject() and 
throws exception on PropertiesResourceBundle and ListResourceBundle.

2) The order to get a bundle is a little tricky. Javadoc should be read :

    * baseName + "_" + selectedLanguage + "_" + country1 + "_" + variant1
    * baseName + "_" + selectedLanguage + "_" + country1
    * baseName + "_" + selectedLanguage
    * baseName + "_" + defaultLocaleLanguage + "_" + country2 + "_" + variant2
    * baseName + "_" + defaultLocaleLanguage + "_" + country2
    * baseName + "_" + defaultLocaleLanguage
    * baseName 
Which means that if a bundle exists by that baseName for your defaultLocale 
(Locale.getDefault()), you'll get values from it instead of from the baseName 
bundle.

Thanks to Chris Hostetter and Otis Gospodnetic for your comments and questions.

> QueryParser with Locale Based Operators (French included)
> ---------------------------------------------------------
>
>                 Key: LUCENE-682
>                 URL: http://issues.apache.org/jira/browse/LUCENE-682
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: QueryParser
>            Reporter: Patrick Turcotte
>            Priority: Minor
>         Attachments: LocalizedQueryParser.zip, LocalizedQueryParserDemo.java, 
> QueryParser.jj, QueryParser.jj.patch, QueryParser.properties, 
> QueryParser_fr.properties, TestQueryParserLocaleOperators.java
>
>
> Here is a version of the QueryParser that can "understand" the AND, OR and 
> NOT keyword in other languages.
> If activated, 
> - "a ET b" should return the same query as "a AND b", namely: "+a +b"
> - "a OU b" should return the same query as "a OR b", namely: "a b"
> - "a SAUF b" should return the same query as "a NOT b", namely: "a -b"
> Here are its main points : 
> 1) Patched from revision 454774 of lucene 2.1dev (trunk) (probably could be 
> used with other versions)
> 2) The "ant test" target is still successful when the modified QueryParser is 
> used
> 3) It doesn't break actual code
> 4) The default behavior is the same as before
> 5) It has to be deliberately activated
> 6) It use ResourceBundle to find the keywords translation
> 7) Comes with FRENCH translation
> 8) Comes with JUnit testCases
> 9) Adds 1 public method to QueryParser
> 10) Expands the TOKEN <TERM>
> 11) Use TOKEN_MGR_DECLS to set some field for the TokenManager

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to