I think Edwin might be concerned that in storing it as a long type, there will 
be no distinguishing between, in example, $1234.56 and $123456. 
But correct me if I'm wrong - the latter would be stored as 12345600. 

When sending in a search for all values less than $100,000 on a long field, 
will there be a need to send in that value in cents? (That is, 
q=*:*&fq=long_field[* TO 10000000] )

Thanks,

Esther Quansah

> Le 7 déc. 2016 à 07:26, Dorian Hoxha <dorian.ho...@gmail.com> a écrit :
> 
> Come on dude, just use the int/long.
> Source: double is still a float.
> 
> On Wed, Dec 7, 2016 at 1:17 PM, Zheng Lin Edwin Yeo <edwinye...@gmail.com>
> wrote:
> 
>> Thanks for the reply.
>> 
>> How about using the double fieldType?
>> I tried that it works, as it is 64-bit, as compared to 32-bit for float.
>> But will it hit the same issue again if the amount exceeds 64-bit?
>> 
>> Regards,
>> Edwin
>> 
>> 
>>> On 7 December 2016 at 15:28, Dorian Hoxha <dorian.ho...@gmail.com> wrote:
>>> 
>>> Yeah, you'll have to do the conversion yourself (or something internal,
>>> like the currencyField).
>>> 
>>> Think about it as datetimes. You store everything in utc (cents), but
>>> display to each user in it's own timezone (different currency, or just
>> from
>>> cents to full dollars).
>>> 
>>> On Wed, Dec 7, 2016 at 8:23 AM, Zheng Lin Edwin Yeo <
>> edwinye...@gmail.com>
>>> wrote:
>>> 
>>>> But if I index $1234.56 as "123456", won't it affect the search or
>> facet
>>> if
>>>> I do a query directly to Solr?
>>>> 
>>>> Say if I search for index with amount that is lesser that $2000, it
>> will
>>>> not match, unless when we do the search, we have to pass "200000" to
>>> Solr?
>>>> 
>>>> Regards,
>>>> Edwin
>>>> 
>>>> 
>>>> On 7 December 2016 at 07:44, Chris Hostetter <hossman_luc...@fucit.org
>>> 
>>>> wrote:
>>>> 
>>>>> : Thanks for your reply.
>>>>> :
>>>>> : That means the best fieldType to use for money is currencyField,
>> and
>>>> not
>>>>> : any other fieldType?
>>>>> 
>>>>> The primary use case for CurrencyField is when you want to do dynamic
>>>>> currency fluctuations between multiple currency types at query time
>> --
>>>> but
>>>>> to do that you either need to use the FileExchangeRateProvider and
>> have
>>>>> your owne backend system to update the exchange rates, or you have to
>>>> have
>>>>> an openexchangerates.org account, or implement some other provider
>>> (with
>>>>> custom solr java code)
>>>>> 
>>>>> 
>>>>> If you only care about a single type of currency -- for example, if
>> all
>>>>> you care about is is US Dollars -- then just use either
>>>>> TrieIntField or TrieLongField and represent in the smallest possible
>>>>> increment you need to measure -- for US Dollars this would be cents.
>>> ie:
>>>>> $1234.56 would be put in your index as "123456"
>>>>> 
>>>>> 
>>>>> 
>>>>> -Hoss
>>>>> http://www.lucidworks.com/
>>>>> 
>>>> 
>>> 
>> 

Reply via email to