lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@googlemail.com>
Subject Re: MultiSegmentReader problems - current is null
Date Tue, 30 Jun 2009 13:10:23 GMT
Hi,
On Sun, Jun 28, 2009 at 2:39 PM, liat oren<oren.liat@gmail.com> wrote:
> 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.
same answer as in the last email you must call TermDocs#next() this
will set TermDocs#current

TermDocs tDocs = this.indexReader.termDocs(term);
tDocs.next()
 tf = tDocs.freq();

simon
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message