You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by liat oren <or...@gmail.com> on 2009/06/28 14:39:49 UTC

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

Re: MultiSegmentReader problems - current is null

Posted by liat oren <or...@gmail.com>.
Ok, thanks a lot - I iwll try that tomorrow

Best,
Liat

2009/6/30 Simon Willnauer <si...@googlemail.com>

> Hi,
> On Sun, Jun 28, 2009 at 2:39 PM, liat oren<or...@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
>
>

Re: MultiSegmentReader problems - current is null

Posted by Simon Willnauer <si...@googlemail.com>.
Hi,
On Sun, Jun 28, 2009 at 2:39 PM, liat oren<or...@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


Re: MultiSegmentReader problems - current is null

Posted by liat oren <or...@gmail.com>.
lucene-2.4.1

Thanks,
Liat

2009/6/29 Simon Willnauer <si...@googlemail.com>

> Quick question, which version of lucene do you use?!
>
> simon
>
> On Mon, Jun 29, 2009 at 9:55 AM, liat oren<or...@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
> > of a multi-segment, I get the same error..
> >
> > Thanks  alot,
> > Liat
> >
> >
> >
> > 2009/6/28 liat oren <or...@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
>
>

Re: MultiSegmentReader problems - current is null

Posted by Simon Willnauer <si...@googlemail.com>.
Quick question, which version of lucene do you use?!

simon

On Mon, Jun 29, 2009 at 9:55 AM, liat oren<or...@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
> of a multi-segment, I get the same error..
>
> Thanks  alot,
> Liat
>
>
>
> 2009/6/28 liat oren <or...@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


Re: MultiSegmentReader problems - current is null

Posted by liat oren <or...@gmail.com>.
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 <si...@googlemail.com>

> On Mon, Jun 29, 2009 at 9:55 AM, liat oren<or...@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 <or...@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
>
>

Re: MultiSegmentReader problems - current is null

Posted by Simon Willnauer <si...@googlemail.com>.
On Mon, Jun 29, 2009 at 9:55 AM, liat oren<or...@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 <or...@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


Re: MultiSegmentReader problems - current is null

Posted by liat oren <or...@gmail.com>.
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 <or...@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
>