Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Given a currency field of CurrencyFieldType, the following asymmetric rates:
<rate from="SGD" to="USD" rate="0.72204658296750000000" /> <rate from="USD" to="SGD" rate="1.45506540000000000000" />
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:
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}] }}
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.
Attachments
Attachments
Issue Links
- is caused by
-
SOLR-4138 currency field doesn't work with functions (ie: isn't compatible with frange query)
- Closed