[jira] [Commented] (SOLR-14500) currency function doesn't work for asymmetric rates

2020-05-20 Thread Murray Johnston (Jira)


[ 
https://issues.apache.org/jira/browse/SOLR-14500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17112606#comment-17112606
 ] 

Murray Johnston commented on SOLR-14500:


I've also added a potential fix (solr14500.patch).  All existing tests, 
including the one added in test.patch pass.

> 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: solr14500.patch, test.patch
>
>
> Given a currency field of CurrencyFieldType, the following asymmetric rates:
> {code:java}
> 
>  {code}
> and a price field with a value of "24.50,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)=id%3A57373P16=*%3A*=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.50,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-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (SOLR-14500) currency function doesn't work for asymmetric rates

2020-05-19 Thread Murray Johnston (Jira)


[ 
https://issues.apache.org/jira/browse/SOLR-14500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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}
> 
>  {code}
> and a price field with a value of "24.50,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)=id%3A57373P16=*%3A*=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.50,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-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org