there is my code for getting in position for all term index and I'm stuck on this problem!!!! anyone has an idea about this error??ar = (AtomicReader)readre; System.out.print(ar); boolean withOffsets = false; Fields fields = MultiFields.getFields(readre); Term t= new Term("contents"); DocsAndPositionsEnum td = ar.termPositionsEnum(ar.getLiveDocs(), t.field(), t.bytes(), withOffsets); int freq = td.freq(); for (int i = 0; i < freq; i++) { int pos= td.nextPosition(); System.out.println(String.valueOf(pos)); }
Exception in thread "main" java.lang.ClassCastException: org.apache.lucene.index.StandardDirectoryReader cannot be cast to org.apache.lucene.index.AtomicReader at Searcher.searchIndex(Searcher.java:59) at Searcher.main(Searcher.java:143) PS: i work with lucene 4.0.0 et sorry for my bad english :)