lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <>
Subject [jira] [Updated] (SOLR-4138) currency field isn't compatible with frange query
Date Tue, 04 Dec 2012 23:41:00 GMT


Hoss Man updated SOLR-4138:

    Attachment: SOLR-4138.patch

Thanks for reporting this Grzegorz,

The general problem seems to be that while CurrencyField has a CurrencyValueSource that it
uses for range queries and sorting, it doesn't override FieldType.getValueSource() to return
one of these in cases when people use currency fields in functions. 

Even with this simple addition however, your test as written still doesn't pass, because CurrencyValueSource
operates using the internal "long" values of the currency, based on Currency.getDefaultFractionDigits()
for the default currency .. so if USD is the configured default, you get a value of "500.0"
(cents) from the value source instead of "5.0" when a document is indexed with a value of

I've attached a patch with the trivial getVaueSource() and tests showing the _current_ behavior,
but i'm not entirely certain if this is really the behavior we want ... changing it would
probably require some meaty rewrites to CurrencyValueSource to take in options about whether
the getDefaultFractionDigits() logic should be "undone" to produce the more human friendly
values ... or perhaps just wrapping it in a special ValueSource that applies that logic in
the getValueSource case so existing usages in getRangeQuery would be unaffected.
> currency field isn't compatible with frange query
> -------------------------------------------------
>                 Key: SOLR-4138
>                 URL:
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 4.0
>            Reporter: Grzegorz Sobczyk
>         Attachments: SOLR-4135-test.patch, SOLR-4138.patch
> Filtering using {!frange} syntax isn't work properly. (rather at all)

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