You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Wilton, Reece" <Re...@dig.com> on 2003/09/10 03:03:12 UTC

Multiple reads from an IndexSearcher?

Hi,

I have a single IndexSearcher pointing at an index.  Multiple threads
are calling the search method.  Is this safe to do?  I presume it is the
right way to do it instead of creating a new IndexSearcher per thread.

But I'm having the dreaded "Too many open files" exception.  I'm running
on Windows XP (of course, otherwise it would work!).  Any ideas on how
to fix this (other than upgrading to Linux)?  Is having one
IndexSearcher the right thing to do?  No other processes are accessing
this index so I'm surprised that I'm getting this error.

Here's the exception:

*E,17:25:19.649,/HyphenTest 5> java.io.IOException: Too many open files
*E,17:25:19.664,/HyphenTest 5> 	at
java.io.WinNTFileSystem.createFileExclusively(Native Method)
*E,17:25:19.664,/HyphenTest 5> 	at
java.io.File.createNewFile(File.java:828)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.store.FSDirectory$1.obtain(FSDirectory.java:324)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.store.Lock.obtain(Lock.java:91)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.store.Lock$With.run(Lock.java:146)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.index.IndexReader.open(IndexReader.java:103)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.index.IndexReader.open(IndexReader.java:91)
*E,17:25:19.664,/HyphenTest 5> 	at
org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:75)

Any help/advice is appreciated,
Reece

Re: Multiple reads from an IndexSearcher?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Yes, you can use a single IndexSearcher with multiple threads.  I have
done so in servlet environments.
This is a common question, so I suggest you check the archives.
Make sure your index is optimized.

Otis

--- "Wilton, Reece" <Re...@dig.com> wrote:
> Hi,
> 
> I have a single IndexSearcher pointing at an index.  Multiple threads
> are calling the search method.  Is this safe to do?  I presume it is
> the
> right way to do it instead of creating a new IndexSearcher per
> thread.
> 
> But I'm having the dreaded "Too many open files" exception.  I'm
> running
> on Windows XP (of course, otherwise it would work!).  Any ideas on
> how
> to fix this (other than upgrading to Linux)?  Is having one
> IndexSearcher the right thing to do?  No other processes are
> accessing
> this index so I'm surprised that I'm getting this error.
> 
> Here's the exception:
> 
> *E,17:25:19.649,/HyphenTest 5> java.io.IOException: Too many open
> files
> *E,17:25:19.664,/HyphenTest 5> 	at
> java.io.WinNTFileSystem.createFileExclusively(Native Method)
> *E,17:25:19.664,/HyphenTest 5> 	at
> java.io.File.createNewFile(File.java:828)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.store.FSDirectory$1.obtain(FSDirectory.java:324)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.store.Lock.obtain(Lock.java:91)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.store.Lock$With.run(Lock.java:146)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.index.IndexReader.open(IndexReader.java:103)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.index.IndexReader.open(IndexReader.java:91)
> *E,17:25:19.664,/HyphenTest 5> 	at
> org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:75)
> 
> Any help/advice is appreciated,
> Reece
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com