lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Fodor (JIRA)" <>
Subject [jira] Commented: (SOLR-2202) Money FieldType
Date Wed, 27 Oct 2010 21:35:19 GMT


Greg Fodor commented on SOLR-2202:

I've attached an updated patch. In the process of removing the cruft for Currency parsing,
I pulled everything that was in Lucene out. This is entirely a Solr-based patch now.

Money based field expect their values in the form <long>,<ISO code> where <long>
is the converted long value based upon the known currency fraction digits for the ISO code.

Uwe, could you please check my implementation of getRangeQuery()? The way I implemented this
was via the creation of a range query on the TrieField, which has as its range the max and
min potential conversions of the upper and lower bound of the user specified range respectively.
This query is then wrapped with a FilteredQuery that applies a Filter that performs the same
ValueSource based Scorer as before over the documents to determine if they fall within the
range (once converted).

Presumably this means is the outer range query will only pass forward documents to the inner,
more expensive, ValueSource filter if they have amount values that fall within the max and
min possible amounts across all currencies (given the specified range being queried.) I'm
assuming that the Filter in a FilteredQuery is applied *after* the documents are screened
from by the Query being filtered.

> Money FieldType
> ---------------
>                 Key: SOLR-2202
>                 URL:
>             Project: Solr
>          Issue Type: New Feature
>          Components: Schema and Analysis
>    Affects Versions: 1.5
>            Reporter: Greg Fodor
>         Attachments: SOLR-2022-solr-3.patch, SOLR-2202-lucene-1.patch, SOLR-2202-solr-1.patch,
> Attached please find patches to add support for monetary values to Solr/Lucene with query-time
currency conversion. The following features are supported:
> - Point queries (ex: "price:4.00USD")
> - Range quries (ex: "price:[$5.00 TO $10.00]")
> - Sorting.
> - Currency parsing by either currency code or symbol.
> - Symmetric & Asymmetric exchange rates. (Asymmetric exchange rates are useful if
there are fees associated with exchanging the currency.)
> At indexing time, money fields can be indexed in a native currency. For example, if a
product on an e-commerce site is listed in Euros, indexing the price field as "10.00EUR" will
index it appropriately. By altering the currency.xml file, the sorting and querying against
Solr can take into account fluctuations in currency exchange rates without having to re-index
the documents.
> The new "money" field type is a polyfield which indexes two fields, one which contains
the amount of the value and another which contains the currency code or symbol. The currency
metadata (names, symbols, codes, and exchange rates) are expected to be in an xml file which
is pointed to by the field type declaration in the schema.xml.
> The current patch is factored such that Money utility functions and configuration metadata
lie in Lucene (see MoneyUtil and CurrencyConfig), while the MoneyType and MoneyValueSource
lie in Solr. This was meant to mirror the work being done on the spacial field types.
> This patch has not yet been deployed to production but will be getting used to power
the international search capabilities of the search engine at Etsy.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message