Skip to content

Locale parsing issues #13229

@javanna

Description

@javanna

In the query-refactoring branch we noticed weird behaviours related to parsing locales. The two queries affected are query_string and simple_query_string, as they allow users to set the locale used where applicable, depending on the type of lucene query that gets parsed.

Both queries in master parse the locale through our own LocaleUtils#parse method and print it out usingLocale#toString when needed. It turns out that with some locales, our newly added query tests fail given that printing out and reparsing the same locale leads to a different locale. The problem looks very similar to what is explained here: https://issues.apache.org/jira/browse/LUCENE-4021.

I see that we also use LocaleUtils#parse in DateFieldMapper. I think that we should discuss how to address this issue and streamline the solution. I think the best solution would be to parse through Locale#forLanguageTag and print out using Locale#toLanguageTag, but this breaks backwards compatibility it seems. If I make this change SimpleDateMappingTests#testParseLocal fails for instance. Is also our own LocaleUtils still useful?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions