Hi Stephen, On Wed, Oct 23, 2013 at 9:29 AM, Stephen GRAY <stephen.g...@immi.gov.au> wrote: > UNOFFICIAL > Hi everyone, > > I have a question about how to retrieve the values in a > NumericDocValuesField. I understand how to do this in situations where you > have an AtomicReaderContext available > (context.reader().getNumericDocValues(field)). However in a situation where I > have just done a search and only have a searcher available, and I want to get > the NumericDocValue in each document returned by the search, is there a way > to do this?
The purpose of doc values is usually scoring, sorting or faceting but here you are willing to actually use them as stored fields. I would recommend storing this numeric field value twice, once as a NumericDocValuesField and once as a StoredField. Otherwise, what you want to do is still possible (but a bad trade-off), for every document, you can find its AtomicReader by calling ReaderUtil.subIndex on the IndexReader.leaves() of your index reader (that you can get from the IndexSearcher by calling IndexSearcher.getIndexReader). -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org