Getting the FieldInfos from each AtomicReader is the right approach! But, FieldInfos won't tell you which XXXField class was used for the indexing: that information is not fully preserved ...
Mike McCandless http://blog.mikemccandless.com On Thu, Jan 31, 2013 at 6:33 AM, Rolf Veen <rolf.v...@gmail.com> wrote: > Hello, all. > > I want to get a list of field names and types out of an IndexSearcher > or IndexReader (not necesarily Atomic). By type I mean if it was > stored as StringField, LongField, etc. Is this possible ? > > I could get the field names this way, probably not the simplest one > to get a unified field list: > > IndexReader reader = searcher.getIndexReader(); > > for (AtomicReaderContext rc : reader.leaves()) { > AtomicReader ar = rc.reader(); > FieldInfos fis = ar.getFieldInfos(); > for (FieldInfo fi : fis) > System.out.println(fi.name); > } > > > Kind regards, > Rolf. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org