Ohh, right. It resolves the problem I mentioned in the second email I sent.
However, in the first mail I sent, the current of the multi-segment reader is null, which brings that problem. Thanks Liat 2009/6/30 Simon Willnauer <simon.willna...@googlemail.com> > On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.l...@gmail.com> wrote: > > The full error is: > > Exception in thread "main" java.lang.NullPointerException > > at > > Priorart.Lucene.Expert.index.MultiSegmentReader$MultiTermDocs.freq(Mu > > ltiSegmentReader.java:709) > > I looked at issue > > LUCENE-781<https://issues.apache.org/jira/browse/LUCENE-781>- it might > > relates to this one?? > > Though it is closed since 2007. > > > > Hope anyone can help with it - even if I try > > double totalFreqT = ir.termDocs().freq(); - to get the freq using > termDocs > you did not call TermDocs#next() did you?! > Try: > TermDocs docs = it.termDocs(); > docs.next(); > int freq = docs.freq(); > > TermDocs is an enumeration, you have to skip through them to get the > freq of a term within a doc. > > simon > > of a multi-segment, I get the same error.. > > > > Thanks alot, > > Liat > > > > > > > > 2009/6/28 liat oren <oren.l...@gmail.com> > > > >> Hi, > >> > >> I have an index that is a multi-segment index (how come it is created > this > >> way?) > >> > >> When I try to get the freq of a term at the following way: > >> TermDocs tDocs = this.indexReader.termDocs(term); > >> tf = tDocs.freq(); > >> the greq method : > >> public int freq() > >> { > >> return current.freq(); > >> } > >> is in MultiSegmentReader. > >> > >> The current is null, so I get an exception. > >> > >> Should I initialize current? > >> How can I avoid this problem? > >> How can I avoid having a multi-segment index? > >> > >> Many thanks, > >> Liat > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >