lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Halácsy Péter <halacsy.pe...@axelero.com>
Subject RE: Searcher/Reader/Writer Management
Date Wed, 03 Apr 2002 15:05:35 GMT


> -----Original Message-----
> From: Scott Ganyo [mailto:scott.ganyo@eTapestry.com]
> Sent: Wednesday, April 03, 2002 4:44 PM
> To: 'Lucene Developers List'
> Subject: RE: Searcher/Reader/Writer Management
> 
> 
> (quotes clipped for brevity)
> 
> > 1. Why don't we have as many control/manager object as index 
> > we want to use?
> > 2. Why is it a static class with only static methods? 
> 
> That would destroy what this class is attempting to 
> accomplish:  Guarding
> the index resources so that you don't have to think about 
> concurrency.  If
> you could have multiple controllers, they would then have to somehow
> coordinate between themselves... making the class even more complex.
> 
I mean we could have as many instance as many index (path or directory) we want to manage.
For example
IndexAccessControl iac = new IndexAccessControl(myPath);
Searcher searcher = iac.getSearcher();


> > 3. Couldn't we wrap the release logic into a 
> > ControledSearcher (Yesterday I've writter CachedSearcher)?
> 
> Nope.  For example, in my application I need to hold onto a 
> single Searcher
> during the course of a transaction... if I was forced to use 
> a new Searcher
> for each query, I couldn't be guaranteed consistent results 
> throughout the
> transaction.

You are not forced. You can hold reference to ControledSearcher as long you want. I only suggest
that developer should call
searcher.close()
instead of
IndexAccessControl.releaseSearcher(searcher)


> 
> > 4. If I understand your code index can't be written while 
> > there is opened searcher? Is it right? I don't understand 
> > what is the connection between Reader and Writer instances on 
> > the same index.
> 
> You should be able to get a writer while searchers are in 
> use, but not while
> a reader is in use.  Did you see a place where this is not 
> the case?  I
> should have mentioned: In this scenario, Readers are assumed 
> to be used for
> delete (since they can be), so a Writer cannot be retrieved 
> while a Reader
> is open and vice versa.
> 

Ok, I see.
> 
> Scott
> 

peter

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message