lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjiao <jianjiao1...@hotmail.com>
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));
}
reader.close();

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
E:\temp\nlucene-1.2b2\src\Index\FieldInfos.cs:
line 143
   at DotnetPark.NLucene.Index.FieldInfos.FieldName(Int32 fieldNumber) in
E:\temp\nlucene-1.2b2\src\Index\FieldInfos.cs:
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
E:\temp\nlucene-1.2b2\src\Index\TermInfosReader.cs
:line 184
   at DotnetPark.NLucene.Index.TermInfosReader.Get(Term term) in
E:\temp\nlucene-1.2b2\src\Index\TermInfosReader.cs:line
 172
   at DotnetPark.NLucene.Index.SegmentReader.DocFreq(Term t) in
E:\temp\nlucene-1.2b2\src\Index\SegmentReader.cs:line 25
6
   at DotnetPark.NLucene.Index.SegmentsReader.DocFreq(Term t) in
E:\temp\nlucene-1.2b2\src\Index\SegmentsReader.cs:line
175
   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.

Jian
-- 
View this message in context: http://www.nabble.com/Document-Frequency-Error-tp17348537p17348537.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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