Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

MultiSegmentReader problems - current is null

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


oren.liat at gmail

Jun 28, 2009, 5:39 AM

Post #1 of 8 (781 views)
Permalink
MultiSegmentReader problems - current is null

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


oren.liat at gmail

Jun 29, 2009, 12:55 AM

Post #2 of 8 (733 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

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
of a multi-segment, I get the same error..

Thanks alot,
Liat



2009/6/28 liat oren <oren.liat [at] gmail>

> 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
>


simon.willnauer at googlemail

Jun 29, 2009, 3:11 AM

Post #3 of 8 (716 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

Quick question, which version of lucene do you use?!

simon

On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.liat [at] gmail> 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
> of a multi-segment, I get the same error..
>
> Thanks  alot,
> Liat
>
>
>
> 2009/6/28 liat oren <oren.liat [at] gmail>
>
>>  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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


oren.liat at gmail

Jun 30, 2009, 5:45 AM

Post #4 of 8 (704 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

lucene-2.4.1

Thanks,
Liat

2009/6/29 Simon Willnauer <simon.willnauer [at] googlemail>

> Quick question, which version of lucene do you use?!
>
> simon
>
> On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.liat [at] gmail> 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
> > of a multi-segment, I get the same error..
> >
> > Thanks alot,
> > Liat
> >
> >
> >
> > 2009/6/28 liat oren <oren.liat [at] gmail>
> >
> >> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


simon.willnauer at googlemail

Jun 30, 2009, 5:52 AM

Post #5 of 8 (711 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.liat [at] gmail> 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 [at] gmail>
>
>>  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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


oren.liat at gmail

Jun 30, 2009, 6:00 AM

Post #6 of 8 (708 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

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.willnauer [at] googlemail>

> On Mon, Jun 29, 2009 at 9:55 AM, liat oren<oren.liat [at] gmail> 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 [at] gmail>
> >
> >> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


simon.willnauer at googlemail

Jun 30, 2009, 6:10 AM

Post #7 of 8 (701 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

Hi,
On Sun, Jun 28, 2009 at 2:39 PM, liat oren<oren.liat [at] gmail> 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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


oren.liat at gmail

Jun 30, 2009, 1:27 PM

Post #8 of 8 (691 views)
Permalink
Re: MultiSegmentReader problems - current is null [In reply to]

Ok, thanks a lot - I iwll try that tomorrow

Best,
Liat

2009/6/30 Simon Willnauer <simon.willnauer [at] googlemail>

> Hi,
> On Sun, Jun 28, 2009 at 2:39 PM, liat oren<oren.liat [at] gmail> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.