Where do you get the docid from? Usually its best to just look at the whole algorithm, e.g. docids come from per-segment readers by default anyway so ideally you want to access any per-document things from that same segmentreader.
As far as supporting docvalues, FieldCache API "passes thru" to docvalues transparently if its enabled for the field. On Mon, Jul 1, 2013 at 4:55 PM, Michael Ryan <mr...@moreover.com> wrote: > I have some custom code that uses the top-level FieldCache (e.g., > FieldCache.DEFAULT.getLongs(reader, "foobar", false)). I'd like to redesign > this to use the per-segment FieldCaches so that re-opening a Searcher is > fast(er). In most cases, I've got a docId and I want to get the value for a > particular single-valued field for that doc. > > Is there a good place to look to see example code of per-segment > FieldCache use? I've been looking at PerSegmentSingleValuedFaceting, but > hoping there might be something less confusing :) > > Also thinking DocValues might be a better way to go for me... is there any > documentation or example code for that? > > -Michael >