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 Sat, 28 Jan 2012 04:15:46 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=8&rev2=9

  {{{
  <doc>
    <field name="id">1</field>
-   <field name="price">100,USD</field>
+   <field name="price">1.00,USD</field>
  </doc>
  }}}
  
- The monetary amount (in this case, 100) is an integer 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. 
+ Here, 1.00,USD is assumed to mean $1.00. Note that regardless of the currency being indexed,
you must encode the value as a floating point value (with a decimal point.) 
  
  
  === Querying ===
  The !MoneyFieldType supports both point queries and range queries. Here are some valid money
queries. Assume default currency is {{{EUR}}}:
  {{{
- price:2500,EUR                 or price:2500               Both of these will query for
€25.00 (the two last digits being decimals)
+ price:25.00,EUR                 or price:25.00               Both of these will query for
€25.00 
- price:[* TO 1000,EUR]          or price:[* TO 1000]
+ price:[* TO 10.00,EUR]          or price:[* TO 10.00]
- price:[1000,USD TO 10000,USD]                              Meaning between $10.00 and $100.00
+ price:[10.00,USD TO 100.00,USD]                              Meaning between $10.00 and
$100.00
- price:1000,NOK
+ price:10.00,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.
+ 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 apply the same exchange rates in the currency.xml file available to Solr.
   
  == TODO ==
  

Mime
View raw message