I think you just forgot to call iw.addDocument(doc)? Typically one needs DocValues in a Collector or a FieldComparator or Filter or a Similarity Scorer, etc., which already operate per-segment and provide you an AtomicReaderContext from which you can get the AtomicReader to lookup DocValues from ...
Mike McCandless http://blog.mikemccandless.com On Wed, Dec 12, 2012 at 12:51 PM, Varun Thacker <varunthacker1...@gmail.com> wrote: > I'm using trunk to try out DocValues. > > Directory directory = new RAMDirectory(); > > IndexWriterConfig iwConfig = new IndexWriterConfig( > Version.LUCENE_41, new StandardAnalyzer(Version.LUCENE_41)); > > IndexWriter iw = new IndexWriter(directory, iwConfig); > Document doc = new Document(); > IntDocValuesField numberField = new IntDocValuesField("number", 1); > doc.add(numberField); > > iw.commit(); > iw.close(); > > IndexReader reader = DirectoryReader.open(directory); > > AtomicReader aReader = SlowCompositeReaderWrapper.wrap(reader); > > DocValues docValues = aReader.docValues("number"); > Source source = docValues.getSource(); > > > docValues is null. Am I using the API correctly? > > Also what are the other ways to open a AtomicReader read DocValues > > > > -- > > > Regards, > Varun Thacker > http://www.vthacker.in/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org