lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Currens (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LUCENENET-493) Make lucene.net culture insensitive (like the java version)
Date Mon, 18 Jun 2012 19:05:43 GMT

     [ https://issues.apache.org/jira/browse/LUCENENET-493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Christopher Currens updated LUCENENET-493:
------------------------------------------

    Attachment: UpdatedLocalizedTestCase.patch

I've updated LocalizedTestCase, so that it will actually run against all installed cultures.
 The workaround is unfortunate...there is now only 1 test that does all localization checks.
 It's done more or less the same way that java does it, however, instead of being able to
override the {{runBare()}} method, I've created a test method that will run all methods in
all installed cultures.  If a method were to fail, it would list the method name, and the
culture it failed in.  I've attached a patch that shows the solution, so if anyone has a better
solution, we can discuss that and possibly use it instead.

Interestingly enough, the tests that Java Lucene has set to test, don't actually fail when
using the older code that doesn't have localization changes in it.  However, when I added
{{TestBoost}} to the list in {{TestQueryParser}}, that one did fail before the push that Simon
did.  So, it concerns me that we don't have enough tests written that actually will cause
it to fail, when run as a localized test.

So, what I propose we do before we apply Luc's patch, is to write tests that *will fail* when
using as a LocalizedTestCase and then make sure his patch makes all of the tests pass.
                
> Make lucene.net culture insensitive (like the java version)
> -----------------------------------------------------------
>
>                 Key: LUCENENET-493
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-493
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Core, Lucene.Net Test
>    Affects Versions: Lucene.Net 3.0.3
>            Reporter: Luc Vanlerberghe
>              Labels: patch
>             Fix For: Lucene.Net 3.0.3
>
>         Attachments: Lucenenet-493.patch, UpdatedLocalizedTestCase.patch
>
>
> In Java, conversion of the basic types to and from strings is locale (culture) independent.
For localized input/output one needs to use the classes in the java.text package.
> In .Net, conversion of the basic types to and from strings depends on the default Culture.
 Otherwise you have to specify CultureInfo.InvariantCulture explicitly.
> Some of the testcases in lucene.net fail if they are not run on a machine with culture
set to US.
> In the current version of lucene.net there are patches here and there that try to correct
for some specific cases by using string replacement (like  System.Double.Parse(s.Replace(".",
CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)), but that seems really ugly.
> I submit a patch here that removes the old workarounds and replaces them by calls to
classes in the Lucene.Net.Support namespace that try to handle the conversions in a compatible
way.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message