I have a solr CurrencyFieldType setup already. I am wondering if there is anyway to query the index and have all results converted to a common currency.
For example if I do a query for Revenue_c:*
I get back documents like:
{
"Revenue_c":"1.00,EUR"
},
{
"Revenue_c":"1.00,CAD"
},
{
"Revenue_c":"1.00,USD"
}
I would like the get the results all converted to the currency of my choosing:
{
"Revenue_c":"1.08,USD",
},
{
"Revenue_c":"0.74,USD"
},
{
"Revenue_c":"1.00,USD"
}
You can get values in desired currency using currency(field_name,[currency_code])
function in your query.
But you need to use new currency type: CurrencyFieldType
, not CurrencyField
which is deprecated. Check the configuration guide here
I have not found currency
function in docs but it's described in the ticket and also might be useful to check the implementation.
For general information on function queries check the docs.