lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Varun Thacker <varunthacker1...@gmail.com>
Subject Re: DocValues API and behaviour when no values for a field in an segment
Date Fri, 10 Jul 2015 10:04:41 GMT
Thanks Adrien! That makes sense now.

DocValues.getSortedSet is pretty cool since the app doesn't need to worry
about if the field is single valued or multi valued.

On Thu, Jul 9, 2015 at 5:16 PM, Adrien Grand <jpountz@gmail.com> wrote:

> LeafReader.get*Values is a low-level API whose return value depends on
> what you indexed: if you did not add doc values to your documents then
> it will return null. This is similar to Fields.terms which returns
> null if you did not index a field.
>
> On the other hand, DocValues.get* is higher-level and makes consuming
> doc values easier. In that particular case, it just saves a null check
> but there are more useful methods like DocValues.getSortedSet which
> allow to treat fields which have been indexed with
> DocValuesType.SORTED and DocValuesType.SORTED_SET the same way.
>
> On Thu, Jul 9, 2015 at 1:04 PM, Varun Thacker
> <varunthacker1989@gmail.com> wrote:
> > Currently we have two APIs for getting DocValues for a field -
> >
> > 1. DocValues.getSorted(r, "bogus")
> > 2. r.getSortedSetDocValues("bogus");
> >
> > Both the javadocs clearly state that 1 will return an empty set and 2
> will
> > return null if no values for the field are present in an segment.
> >
> > Was curious as to why do we have two different ways to fetch it and why
> do
> > they have an different behaviour on no values for the field are present
> in
> > an segment.
> >
> > --
> >
> >
> > Regards,
> > Varun Thacker
>
>
>
> --
> Adrien
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 


Regards,
Varun Thacker

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message