Issue while adding Long.MAX_VALUE to a TrieLong field

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue while adding Long.MAX_VALUE to a TrieLong field

Pushkar Raste
I am trying following add document (value for price.long is Long.MAX_VALUE)

  <doc>
        <field name="id">411</field>
        <field name="name">one</field>
        <field name="price.long">9223372036854775807</field>
   </doc>

However upon querying my collection value I get back for "price.long"
is  9223372036854776000
(I got same behavior when I used JSON file)

Definition for 'price.long' field and 'long' look like following

<field name="price.long" type="long" indexed="true" stored="true" />
<fieldType name="long" class="solr.TrieLongField" precisionStep="0"
positionIncrementGap="0"/>

My test case shows that MAX Value Solr can store without losing precision
is  18014398509481982. This is equivalent to '2 ^53 - 1'  (Not really sure
if this computation really means something).

I wrote test using SolrTestHarness and it successfully saved value
9223372036854775807 to Solr.

Can someone help to understand why TrieLong can't accept values >
18014398509481982, when I try to use XML/JSON file to add a document
Reply | Threaded
Open this post in threaded view
|

Re: Issue while adding Long.MAX_VALUE to a TrieLong field

Yonik Seeley
On Thu, Sep 10, 2015 at 5:43 PM, Pushkar Raste <[hidden email]> wrote:

Did you see my previous response to you today?
http://markmail.org/message/wt6db4ocqmty5a42

Try querying a different way, like from the command line using curl,
or from your browser, but not through the solr admin.

[...]
> My test case shows that MAX Value Solr can store without losing precision
> is  18014398509481982. This is equivalent to '2 ^53 - 1'  (Not really sure
> if this computation really means something).

53 happens to be the effective number of mantissa bits in a 64 bit
double precision floating point ;-)

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: Issue while adding Long.MAX_VALUE to a TrieLong field

Pushkar Raste
Thank you Yonik, looks like I missed previous reply. This is seems logical
as Max Long in java script is (2^53 - 1), which the max value I can insert
and validate through Admin UI. Never though Admin UI itself would trick me
though.


On Thu, Sep 10, 2015 at 6:01 PM, Yonik Seeley <[hidden email]> wrote:

> On Thu, Sep 10, 2015 at 5:43 PM, Pushkar Raste <[hidden email]>
> wrote:
>
> Did you see my previous response to you today?
> http://markmail.org/message/wt6db4ocqmty5a42
>
> Try querying a different way, like from the command line using curl,
> or from your browser, but not through the solr admin.
>
> [...]
> > My test case shows that MAX Value Solr can store without losing precision
> > is  18014398509481982. This is equivalent to '2 ^53 - 1'  (Not really
> sure
> > if this computation really means something).
>
> 53 happens to be the effective number of mantissa bits in a 64 bit
> double precision floating point ;-)
>
> -Yonik
>