lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject RE: concurrent usage summary
Date Fri, 07 Dec 2001 17:37:38 GMT
> From:
> It looks like Lucene supports concurrent searchs as long as 
> the index is not
> modified with add, delete, or optimize actions (and maybe 
> others?).

Searches may be made at any time, including while the index is being
modified by the add, delete and optimize operations.  

> For those
> actions, it is not clear what is happening (at least for me) with open
> searchers, readers and writers. Can those be reused freely ?
> When should they be opened/closed ?

Searchers and readers may be used freely until they are closed.  A single
searcher and reader may be shared by many threads, conducting concurrent
searches.  That is in fact recommended.  A reader will close itself when
garbage collected, so don't worry about explicitly closing readers (unless
you are near yout file descriptor limit).

Only a single writer should exist at once.  Readers opened after it is
closed will see the changes made to it.

> Can I add/delete documents while another 
> thread is looping on
> Hits ?


> A brief summary of what can/cannot be done when modifying an 
> index (and related
> issues) would be very appreciated.

The prohibitions are:
  - don't use a reader/writer after it has been closed;
  - don't try to write simultaneously from different processes


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message