You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Marcelino Ponty <ma...@yahoo.com> on 2009/11/26 20:47:46 UTC

[ask] index out of range exceptions.

Hi all!

I'm a new user of Lucene.NET, but I have experience once in using Ferret which is written in Ruby language. I've come to a problem and hope any of you can help me.

I'm going to index 50,000 doc, but it failed and give 

System.IndexOutOfRangeExceptions: Index was outside the bound of the array.

I test with 30,000 doc and it succeed. I think this has something to do with basic predefined parameters while setting up the indexing process which I should have set, but I don't know which parameter it is and where should I set it. Do you guys have any idea? I think the answer should be simple. In Ferret, I didn't meet this problem.

Thanks for any assistance!
Regards,
Marcelino Ponty
(Phone +62819 - 3223 54 84)
"Ad Maiorem Dei Gloriam"


      

Re: [ask] index out of range exceptions.

Posted by Marcelino Ponty <ma...@yahoo.com>.
Hi Michael, thx for your assistance! 

I haven't tried the Lucene 2.4 though I have download it from the svn, since I prefer a .dll file. I haven't tried build it from visual studio, I'm affraid building it by hand will take some more time for me. I've finally tricks the program, by indexing 30000 doc, close the writer, then index the next 30000 docs, and it seems to work, though I still not understand why it goes that way. I think it's because my single document have too much field and each field's content is rather long. I tried to index one field only, and it works even for 100000 docs, so it must have something to do with the content of the doc..

And for the catch statement, thanks for the link, it give me some insight how to use it properly!

Thanks again Michael, for your suggestions!




________________________________
From: Michael Garski <mg...@myspace-inc.com>
To: lucene-net-user@incubator.apache.org
Sent: Fri, November 27, 2009 4:05:59 AM
Subject: RE: [ask] index out of range exceptions.

Marcelino - 

Give it a try with Lucene 2.4 - there is a tag in the SVN repository for it.  If it still occurs, a stack trace with line numbers inside of Lucene would be helpful.  You may want to remove your catch statement completely as you are just re-throwing the exception anyways and could be suppressing the source.

http://blogs.msdn.com/jmstall/archive/2007/02/07/catch-rethrow.aspx

Michael


-----Original Message-----
From: Marcelino Ponty [mailto:marcelino_ponty@yahoo.com]
Sent: Thu 11/26/2009 12:51 PM
To: lucene-net-user@incubator.apache.org
Subject: Re: [ask] index out of range exceptions.

Hi Michael!

Thanks for your fast response!

In the stack trace:
at Lucene.Net.Index.DocumentsWriter.Abort(AbortException ae) at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm) at Lucene.Net.Index.DocumentsWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc) at Atmalib.Lucene.Indexing.ExecuteIndexing(Directory dir) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\CreateIndex\CreateIndex\App_Code\Indexing.cs:line 95

I use Lucene.NET version 2.3.1.2. 

And my program is absolutely simple: 

//main program
        protected static void ExecuteIndexing(Directory dir)
        {
        IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
            try
            {
                string query = "select top 40000 * from v_simple_artikel";
//use public class method to query database
                SqlDataReader row = Atmalib.DataAccess.GetDataReaderFromQuery(query); 

//read query results and add document
                while (row.Read())
                {
                   Document doc = new Document();
               doc.Add(new Field("kode_koleksi", row["kode_koleksi"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));
               doc.Add(new Field("kode_artikel", row["kode_artikel"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));

//....
//adding many other fields
//...

Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
               doc.Add(new Field("kata_kunci_jurnal", row["kata_kunci_jurnal"].ToString(), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   writer.AddDocument(doc);
                }
                writer.Optimize();
            }
            catch (Exception exp)
            {
                throw exp;
            }

            finally
            {
                writer.Close();
            }
        }
//end of main program

I'll be very grateful if you can give me assistance. Thank you!!



________________________________
From: Michael Garski <mg...@myspace-inc.com>
To: lucene-net-user@incubator.apache.org
Sent: Fri, November 27, 2009 2:51:19 AM
Subject: Re: [ask] index out of range exceptions.

Hi Marcelino,

Can you provide tha stack trace from the exception and a code snippet/description of what you are doing when it is thrown along with the version of Lucene.net you are using?

Michael

On Nov 26, 2009, at 11:48 AM, "Marcelino Ponty" <ma...@yahoo.com> wrote:

> Hi all!
> 
> I'm a new user of Lucene.NET, but I have experience once in using Ferret which is written in Ruby language. I've come to a problem and hope any of you can help me.
> 
> I'm going to index 50,000 doc, but it failed and give
> 
> System.IndexOutOfRangeExceptions: Index was outside the bound of the array.
> 
> I test with 30,000 doc and it succeed. I think this has something to do with basic predefined parameters while setting up the indexing process which I should have set, but I don't know which parameter it is and where should I set it. Do you guys have any idea? I think the answer should be simple. In Ferret, I didn't meet this problem.
> 
> Thanks for any assistance!
> Regards,
> Marcelino Ponty
> (Phone +62819 - 3223 54 84)
> "Ad Maiorem Dei Gloriam"
> 
> 


      

RE: [ask] index out of range exceptions.

Posted by Michael Garski <mg...@myspace-inc.com>.
Marcelino - 

Give it a try with Lucene 2.4 - there is a tag in the SVN repository for it.  If it still occurs, a stack trace with line numbers inside of Lucene would be helpful.  You may want to remove your catch statement completely as you are just re-throwing the exception anyways and could be suppressing the source.

http://blogs.msdn.com/jmstall/archive/2007/02/07/catch-rethrow.aspx

Michael


-----Original Message-----
From: Marcelino Ponty [mailto:marcelino_ponty@yahoo.com]
Sent: Thu 11/26/2009 12:51 PM
To: lucene-net-user@incubator.apache.org
Subject: Re: [ask] index out of range exceptions.
 
Hi Michael!

Thanks for your fast response!

In the stack trace:
at Lucene.Net.Index.DocumentsWriter.Abort(AbortException ae) at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm) at Lucene.Net.Index.DocumentsWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc) at Atmalib.Lucene.Indexing.ExecuteIndexing(Directory dir) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\CreateIndex\CreateIndex\App_Code\Indexing.cs:line 95

I use Lucene.NET version 2.3.1.2. 

And my program is absolutely simple: 

//main program
        protected static void ExecuteIndexing(Directory dir)
        {
        IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
            try
            {
                string query = "select top 40000 * from v_simple_artikel";
//use public class method to query database
                SqlDataReader row = Atmalib.DataAccess.GetDataReaderFromQuery(query); 

//read query results and add document
                while (row.Read())
                {
                   Document doc = new Document();
               doc.Add(new Field("kode_koleksi", row["kode_koleksi"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));
               doc.Add(new Field("kode_artikel", row["kode_artikel"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));

//....
//adding many other fields
//...

Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
               doc.Add(new Field("kata_kunci_jurnal", row["kata_kunci_jurnal"].ToString(), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   writer.AddDocument(doc);
                }
                writer.Optimize();
            }
            catch (Exception exp)
            {
                throw exp;
            }

            finally
            {
                writer.Close();
            }
        }
//end of main program

I'll be very grateful if you can give me assistance. Thank you!!



________________________________
From: Michael Garski <mg...@myspace-inc.com>
To: lucene-net-user@incubator.apache.org
Sent: Fri, November 27, 2009 2:51:19 AM
Subject: Re: [ask] index out of range exceptions.

Hi Marcelino,

Can you provide tha stack trace from the exception and a code snippet/description of what you are doing when it is thrown along with the version of Lucene.net you are using?

Michael

On Nov 26, 2009, at 11:48 AM, "Marcelino Ponty" <ma...@yahoo.com> wrote:

> Hi all!
> 
> I'm a new user of Lucene.NET, but I have experience once in using Ferret which is written in Ruby language. I've come to a problem and hope any of you can help me.
> 
> I'm going to index 50,000 doc, but it failed and give
> 
> System.IndexOutOfRangeExceptions: Index was outside the bound of the array.
> 
> I test with 30,000 doc and it succeed. I think this has something to do with basic predefined parameters while setting up the indexing process which I should have set, but I don't know which parameter it is and where should I set it. Do you guys have any idea? I think the answer should be simple. In Ferret, I didn't meet this problem.
> 
> Thanks for any assistance!
> Regards,
> Marcelino Ponty
> (Phone +62819 - 3223 54 84)
> "Ad Maiorem Dei Gloriam"
> 
> 


      

 

Re: [ask] index out of range exceptions.

Posted by Marcelino Ponty <ma...@yahoo.com>.
Hi Michael!

Thanks for your fast response!

In the stack trace:
at Lucene.Net.Index.DocumentsWriter.Abort(AbortException ae) at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm) at Lucene.Net.Index.DocumentsWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer analyzer) at Lucene.Net.Index.IndexWriter.AddDocument(Document doc) at Atmalib.Lucene.Indexing.ExecuteIndexing(Directory dir) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\CreateIndex\CreateIndex\App_Code\Indexing.cs:line 95

I use Lucene.NET version 2.3.1.2. 

And my program is absolutely simple: 

//main program
        protected static void ExecuteIndexing(Directory dir)
        {
        IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
            try
            {
                string query = "select top 40000 * from v_simple_artikel";
//use public class method to query database
                SqlDataReader row = Atmalib.DataAccess.GetDataReaderFromQuery(query); 

//read query results and add document
                while (row.Read())
                {
                   Document doc = new Document();
               doc.Add(new Field("kode_koleksi", row["kode_koleksi"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));
               doc.Add(new Field("kode_artikel", row["kode_artikel"].ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));

//....
//adding many other fields
//...

Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
               doc.Add(new Field("kata_kunci_jurnal", row["kata_kunci_jurnal"].ToString(), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   writer.AddDocument(doc);
                }
                writer.Optimize();
            }
            catch (Exception exp)
            {
                throw exp;
            }

            finally
            {
                writer.Close();
            }
        }
//end of main program

I'll be very grateful if you can give me assistance. Thank you!!



________________________________
From: Michael Garski <mg...@myspace-inc.com>
To: lucene-net-user@incubator.apache.org
Sent: Fri, November 27, 2009 2:51:19 AM
Subject: Re: [ask] index out of range exceptions.

Hi Marcelino,

Can you provide tha stack trace from the exception and a code snippet/description of what you are doing when it is thrown along with the version of Lucene.net you are using?

Michael

On Nov 26, 2009, at 11:48 AM, "Marcelino Ponty" <ma...@yahoo.com> wrote:

> Hi all!
> 
> I'm a new user of Lucene.NET, but I have experience once in using Ferret which is written in Ruby language. I've come to a problem and hope any of you can help me.
> 
> I'm going to index 50,000 doc, but it failed and give
> 
> System.IndexOutOfRangeExceptions: Index was outside the bound of the array.
> 
> I test with 30,000 doc and it succeed. I think this has something to do with basic predefined parameters while setting up the indexing process which I should have set, but I don't know which parameter it is and where should I set it. Do you guys have any idea? I think the answer should be simple. In Ferret, I didn't meet this problem.
> 
> Thanks for any assistance!
> Regards,
> Marcelino Ponty
> (Phone +62819 - 3223 54 84)
> "Ad Maiorem Dei Gloriam"
> 
> 


      

Re: [ask] index out of range exceptions.

Posted by Michael Garski <mg...@myspace-inc.com>.
Hi Marcelino,

Can you provide tha stack trace from the exception and a code snippet/ 
description of what you are doing when it is thrown along with the  
version of Lucene.net you are using?

Michael

On Nov 26, 2009, at 11:48 AM, "Marcelino Ponty" <marcelino_ponty@yahoo.com 
 > wrote:

> Hi all!
>
> I'm a new user of Lucene.NET, but I have experience once in using  
> Ferret which is written in Ruby language. I've come to a problem and  
> hope any of you can help me.
>
> I'm going to index 50,000 doc, but it failed and give
>
> System.IndexOutOfRangeExceptions: Index was outside the bound of the  
> array.
>
> I test with 30,000 doc and it succeed. I think this has something to  
> do with basic predefined parameters while setting up the indexing  
> process which I should have set, but I don't know which parameter it  
> is and where should I set it. Do you guys have any idea? I think the  
> answer should be simple. In Ferret, I didn't meet this problem.
>
> Thanks for any assistance!
> Regards,
> Marcelino Ponty
> (Phone +62819 - 3223 54 84)
> "Ad Maiorem Dei Gloriam"
>
>