You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Yonghui Zhao <zh...@gmail.com> on 2014/03/05 13:00:29 UTC
Sorted NumericDocValues
Hi,
Is there any data type in lucene can support functions like SortedDocValues
for any numeric(int, long, float, double) type.
SortedDocValues only supports bytes, I want some data type can get numeric
value and ord(-1 for doc doesn't have the field) for each doc.
NumericDocValues only supports long type and doesn't support ord function,
for the doc doesn't contain the field NumericDocValues will return 0, which
has no discrimination.
Re: Sorted NumericDocValues
Posted by Michael McCandless <lu...@mikemccandless.com>.
Just index ints as longs; the codec under the hood should be efficient
about storing the bytes (ie, not use more than 4 bytes per doc).
For float/double, use Float.floatToRawIntBits / Double.doubleToRawLongBits.
Mike McCandless
http://blog.mikemccandless.com
On Wed, Mar 5, 2014 at 7:47 AM, Yonghui Zhao <zh...@gmail.com> wrote:
> Yes it works.
>
> I can use AtomicReader.getDocsWithField and NumericDocValues to implement
> my requirement for long by doing a sort.
> But how to deal with other numeric type(int, float, double)?
>
>
>
> 2014-03-05 20:19 GMT+08:00 Michael McCandless <lu...@mikemccandless.com>:
>
>> Just use AtomicReader.getDocsWithField to know whether the doc had that
>> field?
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>>
>> On Wed, Mar 5, 2014 at 7:00 AM, Yonghui Zhao <zh...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > Is there any data type in lucene can support functions like
>> SortedDocValues
>> > for any numeric(int, long, float, double) type.
>> >
>> > SortedDocValues only supports bytes, I want some data type can get
>> numeric
>> > value and ord(-1 for doc doesn't have the field) for each doc.
>> >
>> > NumericDocValues only supports long type and doesn't support ord
>> function,
>> > for the doc doesn't contain the field NumericDocValues will return 0,
>> which
>> > has no discrimination.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorted NumericDocValues
Posted by Yonghui Zhao <zh...@gmail.com>.
Yes it works.
I can use AtomicReader.getDocsWithField and NumericDocValues to implement
my requirement for long by doing a sort.
But how to deal with other numeric type(int, float, double)?
2014-03-05 20:19 GMT+08:00 Michael McCandless <lu...@mikemccandless.com>:
> Just use AtomicReader.getDocsWithField to know whether the doc had that
> field?
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Wed, Mar 5, 2014 at 7:00 AM, Yonghui Zhao <zh...@gmail.com>
> wrote:
> > Hi,
> >
> > Is there any data type in lucene can support functions like
> SortedDocValues
> > for any numeric(int, long, float, double) type.
> >
> > SortedDocValues only supports bytes, I want some data type can get
> numeric
> > value and ord(-1 for doc doesn't have the field) for each doc.
> >
> > NumericDocValues only supports long type and doesn't support ord
> function,
> > for the doc doesn't contain the field NumericDocValues will return 0,
> which
> > has no discrimination.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Sorted NumericDocValues
Posted by Michael McCandless <lu...@mikemccandless.com>.
Just use AtomicReader.getDocsWithField to know whether the doc had that field?
Mike McCandless
http://blog.mikemccandless.com
On Wed, Mar 5, 2014 at 7:00 AM, Yonghui Zhao <zh...@gmail.com> wrote:
> Hi,
>
> Is there any data type in lucene can support functions like SortedDocValues
> for any numeric(int, long, float, double) type.
>
> SortedDocValues only supports bytes, I want some data type can get numeric
> value and ord(-1 for doc doesn't have the field) for each doc.
>
> NumericDocValues only supports long type and doesn't support ord function,
> for the doc doesn't contain the field NumericDocValues will return 0, which
> has no discrimination.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org