lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "CurrencyField" by JanHoydahl
Date Wed, 21 Mar 2012 23:56:47 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "CurrencyField" page has been changed by JanHoydahl:
http://wiki.apache.org/solr/CurrencyField?action=diff&rev1=5&rev2=6

Comment:
OpenExchangeRatesOrgProvider

  If no provider is specified in the fieldType config, {{{FileExchangeRateProvider}}} is used
as default.
  
  ==== FileExchangeRateProvider ====
- This provider ships with Solr and is backed by an XML file {{{currency.xml}}}, and a fieldType
using this provider. It requires one parameter {{{currencyConfig}}} which should point to
your XML file. This config is looked up through Solr's !ResourceLoader.
+ This provider is backed by an XML file {{{currency.xml}}}, and a fieldType using this provider.
It requires one parameter {{{currencyConfig}}} which should point to your XML file. This config
is looked up through Solr's !ResourceLoader.
  
  The example {{{currency.xml}}} file in "conf" folder shows how the config could look. Here's
an example:
  
@@ -73, +73 @@

  
  Replication is supported, given that you explicitly configure replication for {{{currency.xml}}}.
Upon the arrival of a new version of currency.xml, Solr slaves will do a core reload and begin
using the new exchange rates. See [[SolrReplication#How_are_configuration_files_replicated.3F|SolrReplication]]
for more. SolrCloud is also supported since we use !ResourceLoader to load the file.
  
+ ==== OpenExchangeRatesOrgProvider ====
+ This provider downloads and parses the freely available exchange rates from openexchangerates.org,
giving rates between USD and 158 currencies, updated hourly. The rates are symmetrical only.
Rates between any two currencies are calculated using USD as common base. Sample fieldType
configuration:
+ 
+ {{{
+    <!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
+         Parameters:
+           defaultCurrency: Specifies the default currency if none specified. Defaults to
"USD"
+           precisionStep:   Specifies the precisionStep for the TrieLong field used for the
amount
+           providerClass:   Lets you plug in other exchange provider backend:
+                            solr.FileExchangeRateProvider is the default and takes one parameter:
+                              currencyConfig: name of an xml file holding exhange rates
+                            solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
+                              ratesFileLocation: URL or file path to rates JSON file (default
latest.json on the web)
+                              refreshInterval: Number of minutes between each rates fetch
(default: 1440, min: 60)
+    -->
+   <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" 
+              providerClass="solr.OpenExchangeRatesOrgProvider"
+              refreshInterval="60" 
+              ratesFileLocation="http://internal.server/rates.json"/>
+ }}}
+ 
+ This tells the CurrencyField to use the !OpenExchangeRates provider with the rates JSON
file loaded from a local web server, refreshed every hour. The defaults are using the latest
rates file from http://openexchangerates.org/latest.json, refreshed once every day.
+ 
  === Usage ===
  
  Solr documents will always yield the currency values they were indexed with, regardless
of how they were queried for. For example, a set of documents indexed in USD will yield USD
values for its Currency fields regardless if you performed queries in EUR. 

Mime
View raw message