lucene-dev mailing list archives

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

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

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
"5,USD".

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: https://issues.apache.org/jira/browse/SOLR-4138
>             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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message