11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

would allow regular downloading of currency data. See Exchange Rates below for more.<br />

At indexing time, money fields can be indexed in a native currency. For example, if a product on an e-commerce<br />

site is listed in Euros, indexing the price field as "1000,EUR" will index it appropriately. The price should be<br />

separated from the currency by a comma, and the price must be encoded with a floating point value (a decimal<br />

point).<br />

During query processing, range and point queries are both supported.<br />

Exchange Rates<br />

You configure exchange rates by specifying a provider. Natively, two provider types are supported: FileExchan<br />

geRateProvider or OpenExchangeRatesOrgProvider.<br />

FileExchangeRateProvider<br />

This provider requires you to provide a file of exchange rates. It is the default, meaning that to use this provider<br />

you only need to specify the file path and name as a value for currencyConfig in the definition for this type.<br />

There is a sample currency.xml file included with <strong>Solr</strong>, found in the same directory as the schema.xml file.<br />

Here is a small snippet from this file:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

OpenExchangeRatesOrgProvider<br />

You can configure <strong>Solr</strong> to download exchange rates from OpenExchangeRates.Org, with updates rates between<br />

USD and 170 currencies hourly. These rates are symmetrical only.<br />

In this case, you need to specify the providerClass in the definitions for the field type and sign up for an API<br />

key. Here is an example:<br />

<br />

The refreshInterval is minutes, so the above example will download the newest rates every 60 minutes.<br />

The refresh interval may be increased, but not decreased.<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!