I figured it out. Here is what you want to do (excuse the Scala syntax). docValues = DocValues.getSortedSet(contex.reader(), "myField") docValues.setDocument(docNumber) val values = Stream.continually(docValues.nextOrd).takeWhile(_ != SortedSetDocValues.NO_MORE_ORDS).map(b => NumericUtils.prefixCodedToLong(docValues.lookupOrd(b))).toSet
Basically, we set the document, then iterate through the Ords. And then convert the BytesRef to a long. On Fri, Mar 13, 2015 at 2:33 PM, Kevin Osborn <kosb...@centraldesktop.com> wrote: > getSortedNumeric throws the following exception: > > unexpected docvalues type SORTED_SET for field 'space_list' (expected one > of [SORTED_NUMERIC, NUMERIC]). Use UninvertingReader or index with > docvalues. > > If I am reading the doumentation correctly, getSortedNumeric sorts the > values, but it is still for non-multivalued fields. > > On Fri, Mar 13, 2015 at 1:55 PM, Chris Hostetter <hossman_luc...@fucit.org > > wrote: > >> >> : If I am finding the values of a long field for a single numeric field, I >> : just do: >> : >> : DocValues.getNumeric(contex.reader(), "myField").get(docNumber). This >> : returns the value of the field and everything is good. >> : >> : However, my field is a multi-valued long field. So, I need to do: >> : >> : DocValues.getSortedSet(contex.reader(), "myField") >> : This returns a SortedSetDocValues. And now I am a bit lost. I want to >> >> I haven't looked into this closely, but isn't what you want just >> DocValues.getSortedNumeric() ? >> >> >> : As a followup question, I am doing this for a PostFiter. So, >> : DeletagtingCollector.collect(int doc). The value of doc always seems to >> be >> : 0. So, I am assuming this is not the doc ID. Is this the index of the >> : reader at it's current position? >> >> It shouldn't always be 0 -- it should be the docId relative the current >> (Leaf) reader context ... so if you have a lot of segments containing only >> a single document, then it would always be 0. >> >> If you always use the current LeafReaderContext to fetch the DocValues >> (ie: you can load the DocValues in doSetNextReader() and re-use until the >> next doSetNextReader() or finish()) then the docId collected and the docId >> you use to lookup the docValues can be identical, and you can ignore the >> details of where/how the current reader context is in relation to the >> entire index (ie: the docBase) >> >> >> >> -Hoss >> http://www.lucidworks.com/ >> > >