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 HossMan
Date Tue, 05 Mar 2013 02:28:18 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 HossMan:
http://wiki.apache.org/solr/CurrencyField?action=diff&rev1=9&rev2=10

Comment:
notes about SOLR-4515 and clean up examples to be provider specific

  
  == FileExchangeRateProvider ==
  
- 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.
+ This is the default provider used if {{{providerClass}} is not specified. It requires one
parameter {{{currencyConfig}}} which should point to an XML file containing conversion information
(see below). This config is looked up through Solr's !ResourceLoader.
+ 
+ {{{
+    <!-- FileExchangeRateProvider Example
+         Parameters:
+           currencyConfig: name of an xml file holding exhange rates (mandatory)
+    -->
+   <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD"
+              providerClass="solr.FileExchangeRateProvider"
+              currencyConfig="currency.xml"
+    />
+ }}}
  
  The example {{{currency.xml}}} file in "conf" folder shows how the config could look. Here's
an example:
  
@@ -68, +79 @@

  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
+    <!-- OpenExchangeRatesOrgProvider Example
          Parameters:
+           ratesFileLocation: URL or file path to rates JSON file (mandatory)
-           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)
+           refreshInterval: Number of minutes between each rates fetch (default: 1440, min:
60)
     -->
-   <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" 
+   <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD"
-              providerClass="solr.OpenExchangeRatesOrgProvider"
+              providerClass="solr.OpenExchangeRatesOrgProvider" 
               refreshInterval="60" 
-              ratesFileLocation="http://internal.server/rates.json"/>
+              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.
+ This tells the CurrencyField to use the !OpenExchangeRates provider with the rates JSON
file loaded from a local web server, refreshed every hour. 
+ 
+ '''NOTE:''' Up to Solr 4.1, the {{{ratesFileLocation}}} property was not mandatory, and
defaulted to {{{http://openexchangerates.org/latest.json}}}, But due to policy changes at
openexchangerates.org this generic URL has not worked since June 2012, so specifying a specific
URL is now mandatory. See the [[https://openexchangerates.org/documentation|OER Developer
Documentation]] for more details.
  
  = Indexing =
  

Mime
View raw message