You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Murray Johnston (Jira)" <ji...@apache.org> on 2020/05/19 21:41:00 UTC
[jira] [Commented] (SOLR-14500) currency function doesn't work for
asymmetric rates
[ https://issues.apache.org/jira/browse/SOLR-14500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17111552#comment-17111552 ]
Murray Johnston commented on SOLR-14500:
----------------------------------------
I've added a patch to illustrate the issue
> currency function doesn't work for asymmetric rates
> ---------------------------------------------------
>
> Key: SOLR-14500
> URL: https://issues.apache.org/jira/browse/SOLR-14500
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Murray Johnston
> Priority: Minor
> Attachments: test.patch
>
>
> Given a currency field of CurrencyFieldType, the following asymmetric rates:
> {code:java}
> <rate from="SGD" to="USD" rate="0.72204658296750000000" />
> <rate from="USD" to="SGD" rate="1.45506540000000000000" /> {code}
> and a price field with a value of "24.500000,SGD"
> The following usage of the currency function as a pseudo-field in a query returns incorrect values:
> {code:java}
> curl -s 'http://10.43.41.81:32080/solr/product_details/select?fl=price,price_sgd%3Acurrency(price,SGD)&fq=id%3A57373P16&q=*%3A*&rows=1'
> {
> "responseHeader":{
> "zkConnected":true,
> "status":0,
> "QTime":0,
> "params":{
> "q":"*:*",
> "fl":"price,price_sgd:currency(price,SGD)",
> "fq":"id:57373P16",
> "rows":"1"}},
> "response":{"numFound":1,"start":0,"docs":[
> {
> "price":"24.500000,SGD",
> "price_sgd":25.74}]
> }} {code}
> I have traced this to the fact that CurrencyFieldType.getValueSource returns a value that is first converted to the default currency. When dealing with asymmetric rates this always risks introducing conversion errors.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org