lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Rowe (JIRA)" <>
Subject [jira] [Commented] (LUCENE-2411) clean up uses of String.toLowerCase in code
Date Tue, 18 Sep 2012 15:56:07 GMT


Steven Rowe commented on LUCENE-2411:

I think this can be closed as fixed, given that {{-check-forbidden-jdk-apis}} prohibits {{String.toLowerCase()}}:
> clean up uses of String.toLowerCase in code
> -------------------------------------------
>                 Key: LUCENE-2411
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/analysis
>    Affects Versions: 3.1
>            Reporter: Robert Muir
>             Fix For: 4.1
> Uwe recently fixed this in the ThaiWordFilter, which reminded me to search our code for
use of String.toLowerCase()
> The problem with this method is the following:
> * it depends on the "default locale" which is flimsy and should be avoided I think, it
typically just causes problems.
>   This is because there can be hard-to-debug issues if the machine is not configured
correctly for the same Locale
>   at both index and query time.
> * lowercasing with locale-sensitive rules is really only suitable for display and presentation,

>   if we want international lowercasing for search we should be using case folding.
>   This is especially important since otherwise people unknowingly using this special
casing at query-time are
>   not going to get results, e.g. if they use a TermRangeQuery from the queryparser and
it lowercases stuff differently.
> in my opinion we should fix all these methods to use Character.toLowerCase
> (if possible especially for speed with TokenStreams), otherwise String.toLowerCase 
> with the ROOT Locale, new Locale(""). This is closer to case folding.
> If some things really need locale-sensitivity for some extreme reason I think we should
just make the Locale 
> a mandatory parameter.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message