And I'm sure you have a construct like:

try
{
   reader = open()
}
finally
{
 if(reader != null)
   reader.close()
}

right ?

As Grant says should you hold the reader open as long as possible since it
caches a lot of stuff.
Look at a SearcherCache:
http://dev.tailsweep.com/svn/core-lucene/trunk/src/main/java/com/tailsweep/core/lucene/SearcherCache.javawhich
someone provided on the list long time ago.

This will not solve your problem though...

Kindly

//Marcus



On Tue, Aug 5, 2008 at 12:37 PM, Grant Ingersoll <[EMAIL PROTECTED]>wrote:

> You say the stack trace is null, does that mean you are getting an
> NullPointerEx. or that you aren't getting any exception but the reader is
> still null?  Are you sure indexName isn't changing?
>
> Also, it's not very good to open up the Searcher/Reader for every query
> anyway, not that solves this problem.
>
>
> On Aug 5, 2008, at 3:52 AM, xh sun wrote:
>
>  Thanks, John and Marcus.</DIV>
>> Below is the related code in jsp file, and the stacktrace is null even it
>> failed to open the index.
>>
>>        try
>>        {
>>          out.print("To open index");
>>          reader = IndexReader.open(indexName);
>>          out.print("have opened the index");
>>          indexsize=reader.numDocs();
>>          searcher = new IndexSearcher(reader);
>>
>>        }
>>        catch (Exception e)
>>        {
>>        e.printStackTrace();
>>        error = true;
>>        }
>> .....
>>  if (reader != null)
>>    reader.close();
>>  if (searcher != null)
>>    searcher.close();
>>
>> BR,
>> Shawn
>>
>>
>>
>> ----- Original Message ----
>> From: Marcus Herou <[EMAIL PROTECTED]>
>> To: java-user@lucene.apache.org
>> Sent: Tuesday, August 5, 2008 3:00:15 PM
>> Subject: Re: failed to open an indexer after about 20 queries
>>
>> Hi.
>>
>> And some exception stacktrace would be nice as well.
>>
>> Kindly
>>
>> //Marcus
>>
>> On Tue, Aug 5, 2008 at 4:58 AM, John Griffin <[EMAIL PROTECTED]
>> >wrote:
>>
>>  Xh,
>>>
>>> Sorry about those questions. I received two copies of your email. The
>>> first
>>> was corrupt.
>>>
>>> We still need to see more code. No there isn't any special config
>>> necessary.
>>>
>>> John G.
>>>
>>> -----Original Message-----
>>> From: xh sun [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, August 04, 2008 8:34 PM
>>> To: java-user@lucene.apache.org
>>> Subject: failed to open an indexer after about 20 queries
>>>
>>> Hi,
>>> The indexer can't be opened after about 20 queries in linux system, but
>>> it
>>> is fine if the index is in windows  system. The indexer is the same in
>>> both
>>> systems.
>>>          reader = IndexReader.open(indexName);    //failed after about 20
>>> queries
>>>          searcher = new IndexSearcher(reader);
>>>
>>> The reader and search have been closed after each query. Is there any
>>> special configuration for the index in linux system?
>>> Appreicate your help very much.
>>> BR,
>>> Shawn
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> Marcus Herou CTO and co-founder Tailsweep AB
>> +46702561312
>> [EMAIL PROTECTED]
>> http://www.tailsweep.com/
>> http://blogg.tailsweep.com/
>>
>>
>>
>>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Marcus Herou CTO and co-founder Tailsweep AB
+46702561312
[EMAIL PROTECTED]
http://www.tailsweep.com/
http://blogg.tailsweep.com/

Reply via email to