lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Halácsy Péter <>
Subject RE: VOTE: Possible features for next release
Date Fri, 24 May 2002 06:36:44 GMT

> -----Original Message-----
> From: none none []
> Sent: Thursday, May 23, 2002 7:39 PM
> To: Lucene Developers List
> Subject: RE: VOTE: Possible features for next release
> --
 their relationship.
> 4.Keep the index searcher opened inside the servlet or jsp 
> save a lot of time, from my tests on a 1GB index (600k docs) 
> i see an average time like:
> a)open for each request: 110 ms
> b)open just once: 40 ms

An indexsearcher must be closed and reopened if (and only if) the index has been modified.
Scott Ganyo posted an IndexAccessControl class that can be used to manage searchers. After
that we discussed it in private emails. 

I hope this logic can be part of Lucene some time. I've attached my last version of IndexAccessControl
(iac). Use:
// You first make an instance of IndexAccessControl. IAC is as many 
// instances as many directory (or index path) the application wants to use.
IndexAccessControl iac = IndexAccessControl.getInstance(directory);
// Request a searcher
Searcher searcher = iac.getSearcher();

// use the searcher here

// close it: iac won't close the searcher only returns it to a cache (or it can be called
pool with size 1)

This code is as fast as you had only one IndexSearcher in your app (to be exact there is only
one real searcher opened).

IndexAccessControl has also methods for managing Writers and Readers.


ps: to compile this code you must modify some classes of lucene: Searcher, Directory etc.

View raw message