Mailing List Archive

concurrent usage summary
Hi all,

It looks like Lucene supports concurrent searchs as long as the index is not
modified with add, delete, or optimize actions (and maybe others?). 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 ? 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.


JCG



--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: concurrent usage summary [ In reply to ]
> From: jean-christian.gagne@prasahewitt.ch
>
> 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 ?

Yes.

> 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

Doug

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: concurrent usage summary [ In reply to ]
Thanks a lot for the complete answer Doug !

JCG




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