lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravikumar Govindarajan <ravikumar.govindara...@gmail.com>
Subject Re: TermsEnum.docFreq() returns 0
Date Fri, 10 May 2013 12:26:57 GMT
I have to add that the above code is wrong.

It has to be

 while((ref=tEnum.next())!=null)
                    {
                        ref = tEnum.term();
                        tEnum.docFreq(); // Even here VAL=0
                    }

Apologies for the mistake, but the problem remains



On Fri, May 10, 2013 at 5:54 PM, Ravikumar Govindarajan <
ravikumar.govindarajan@gmail.com> wrote:

> We have the following code
>
> SegmentInfos segments = new SegmentInfos();
>  segments.read(luceneDir);
>  for(SegmentInfoPerCommit sipc: segments)
> {
> String name = sipc.info.name;
> SegmentReader reader = new SegmentReader(sipc, 1, new IOContext());
> Terms terms = reader.terms("content");
> TermsEnum tEnum = terms.iterator(null);
>  tEnum.docFreq(); //VAL=0
>  tEnum.totalTermFreq(); //VAL=-1
> }
>
> The field "content" is indexed as DOCS_FREQ_AND_POSITION
>
> Why does the docFreq returned as 0 for all terms. Is this expected or am I
> doing something wrong?
>
> --
> Ravi
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message