lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjiao <>
Subject Document Frequency Error
Date Tue, 20 May 2008 19:19:31 GMT

Hello, guys,

I know this forum is for java user. But I think the .Net version is
converted from Java and I was really blocked by the error. I am using the
NLucene. I am trying to get the document frequency for each term.
The code is as follows.

IndexReader reader = IndexReader.Open("temp_index");
for (ITermEnum termEnum = reader.Terms(); termEnum.Next(); )
    Term indexedTerm = termEnum.Term();
    Console.Write(indexedTerm.Text + " " + reader.DocFreq(indexedTerm));

Error Message
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the
size of the collection.
Parameter name: index
   at System.Collections.ArrayList.get_Item(Int32 index)
   at DotnetPark.NLucene.Index.FieldInfos.FieldInfo(Int32 fieldNumber) in
line 143
   at DotnetPark.NLucene.Index.FieldInfos.FieldName(Int32 fieldNumber) in
line 138
   at DotnetPark.NLucene.Index.SegmentTermEnum.ReadTerm() in
E:\temp\nlucene-1.2b2\src\Index\SegmentTermEnum.cs:line 183

   at DotnetPark.NLucene.Index.SegmentTermEnum.Next() in
E:\temp\nlucene-1.2b2\src\Index\SegmentTermEnum.cs:line 161
   at DotnetPark.NLucene.Index.TermInfosReader.ScanEnum(Term term) in
:line 184
   at DotnetPark.NLucene.Index.TermInfosReader.Get(Term term) in
   at DotnetPark.NLucene.Index.SegmentReader.DocFreq(Term t) in
E:\temp\nlucene-1.2b2\src\Index\SegmentReader.cs:line 25
   at DotnetPark.NLucene.Index.SegmentsReader.DocFreq(Term t) in
   at Test.Program.Main(String[] args) in F:\My
work\CShape\FraudDetection\Test\Program.cs:line 116

The code ran successfully for several terms, then I got an error saying that
"System.ArgumentOutOfRangeException: Index was out of range."
I debugged the code and found that "FieldInfos.FieldName(Int32 fieldNumber)"
the fieldNumber for the term causing the error is 112 which is much greater
than the normal values 0, 1, or 2.

I don't know what is the problem. Can someone help me to solve that?
Thanks a million.

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message