You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ugo Matrangolo <ug...@gmail.com> on 2017/02/14 18:37:15 UTC

NumericDocValues only supports long?

Hi,

I have a corpus where each document contains a field of type Float.

I'm trying to write a PostFilter that returns a DelegatingCollector to
filter all the docs where the value of a function applied to this float
value is lower than a given threshold. I can't precompute/index anything
here.

I have just found that calling IndexReader to read a single document and
then read the stored field of type float that I need is quite expensive so
I was thinking to load all of them at once using:

 LeafReader.numericDocValues($my_float_field_name_here)

Turns out that NumericDocValues only supports long!

How can I access all my float values in the same way ???

Best
Ugo

Re: NumericDocValues only supports long?

Posted by Tomás Fernández Löbbe <to...@gmail.com>.
I think you should use FloatFieldSource. Solr uses
Float.floatToIntBits(floatValue) when adding the DV field, so you could use
Float.intBitsToFloat((int)longValue) when reading (See
TrieField.createFields(...)), but FloatFieldSource is already doing that
for you.

On Tue, Feb 14, 2017 at 10:37 AM, Ugo Matrangolo <ug...@gmail.com>
wrote:

> Hi,
>
> I have a corpus where each document contains a field of type Float.
>
> I'm trying to write a PostFilter that returns a DelegatingCollector to
> filter all the docs where the value of a function applied to this float
> value is lower than a given threshold. I can't precompute/index anything
> here.
>
> I have just found that calling IndexReader to read a single document and
> then read the stored field of type float that I need is quite expensive so
> I was thinking to load all of them at once using:
>
>  LeafReader.numericDocValues($my_float_field_name_here)
>
> Turns out that NumericDocValues only supports long!
>
> How can I access all my float values in the same way ???
>
> Best
> Ugo
>