lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ganyo <>
Subject RE: Searcher/Reader/Writer Management
Date Wed, 03 Apr 2002 14:43:46 GMT
(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.

> 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

> 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.

> 5. Can someone imagine situation when more than one Analyzers 
> are used in an application? 

I could imagine one, but you're right: I certainly didn't design for it.

> 6. Shouldn't we only manage IndexReader and create new 
> instance of Searcher on every request?

Hmm... potentially... haven't really thought about that...

> 7. Finally, I think IndexAccesControl should have the next interface:
> public interface IndexAccessControl {
>   public Searcher getSearcher();
>   public IndexReader getReader();
>   public IndexWriter getWriter();
> }
> and we could have more than one implementation (using JAXP 
> style factories or Avalon or something similar)

To what end?  The rules of index access must be obeyed for proper operation.
If you need specialized behavior, you could just wrap this class with your
specialized class and delegate.  (Which is exactly what I do in my


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message