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 12:52:46 GMT
On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.liat@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.liat@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message