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 "MoneyFieldType" by GregFodor
Date Wed, 28 Sep 2011 18:18:20 GMT
Dear Wiki user,

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

The "MoneyFieldType" page has been changed by GregFodor:
http://wiki.apache.org/solr/MoneyFieldType?action=diff&rev1=4&rev2=5

  
  The MoneyFieldType was created by Greg Fodor in [[https://issues.apache.org/jira/browse/SOLR-2202|SOLR-2202]],
and is an advanced poly field type indexing a monetary value as both value and currency. It
lets e.g. an e-commerce site to display and query prices in many currencies, while only indexing
the price in one field/currency.
  
- The field type is backed by an XML file {{{currency.xml}}} specifying exchange rates. This
file may be updated without need for reindexing, and a reload-core will set live the updated
exchange rates.
+ The field type is backed by an XML file {{{currency.xml}}} specifying exchange rates. This
file may be updated without need for reindexing, and a reload-core will set live the updated
exchange rates.
  
  === Configuration ===
  See example schema for example of how to use the field type. The field type and field is
defined in schema.xml as follows:
@@ -50, +50 @@

  </doc>
  }}}
  
+ The monetary amount (in this case, 100) is not a floating point value, so decimal amounts
must be encoded by convention. Here, 100,USD is assumed to mean $1.00. The exchange rates
in currency.xml are assumed to line up with the conventions used for encoding these values.

+ 
+ 
  === Querying ===
  The !MoneyFieldType supports both point queries and range queries. Here are some valid money
queries. Assume default currency is {{{EUR}}}:
  {{{
@@ -59, +62 @@

  price:1000,NOK
  }}}
  
+ === 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 Money fields regardless if you performed queries in EUR. 
+ 
+ So, for the display of Money fields to a user, it is often necessary to perform a second
currency conversion once the documents are returned for display purposes. For accuracy, this
conversion should use the same exchange rates in the currency.xml file available to Solr.
+  
  == TODO ==
+ 
-  * How do decimals work?
-  * Can you return a value in another currency than what's indexed in the search result?
   * Range facets do not work with this field type - this should be fixed
  

Mime
View raw message