I know it's not the most efficient way but I do close the searched after
every search using:
searcher.close() ;
This saves me the hassle of worrying about memory problems, and the search
on my system is quite intensive about half a million searches a day, I
haven't faced any problems with the opening an closing of searchers anyway
if you keep it open you're in a way going against the garbage collector,
slowly creating your own structured memory leek.

Memory is cheap .. any of my clients would rather pay for a couple gegs of
memory rather than have a team come two months after launch to troubleshoot
a memory leek, somewhat reminiscent of the days of C dangling pointers.
Gratned that one shouldn't go around using memory libraly but some trade
offs do pay off.


Nader Henein

-----Original Message-----
From: Hal�csy P�ter [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 12, 2002 11:18 AM
To: Lucene Users List
Subject: RE: Lucene is not closing connections to index files




> -----Original Message-----
> From: Jason Coleman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 12, 2002 12:25 AM
> To: [EMAIL PROTECTED]
> Subject: Lucene is not closing connections to index files
>
>
> Lucene is not letting go (closing) index files that are being
> searched.
>
> I have not traced exactly where the problem is occurring, so
> I thought I
> would get some ideas first from the board.  It appears that
> when a user does
> a search against the Lucene index files, the connections to
> these files are
> not released.  It continues to maintain a connection until
> the JVM runs out
> of file space.

yes, you are right. you have to close the searcher to release opened files.

> This is how I am querying the index:
>
>
> Searcher searcher = new IndexSearcher(index_path);
> Query query = QueryParser.parse(queryString, "body", new
> StandardAnalyzer());
> hits = searcher.search(query);
>
>
> index_path is just the location of the Lucene index files.  I
> am sure that a
> Reader class somewhere is not being closed properly.  Has
> anyone experienced
> this problem when querying the index?

it's not bug but feature. lucene don't close files after searching only if
you call the close() method. the cause: it's very slow to reopen the files.

you should check the discussion about searcher cache (see mailing list
archive)

peter

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to