lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: IndexWriter and IndexReader in a shared environment
Date Thu, 07 Jul 2016 12:51:56 GMT
The API is pretty simple.

Create IndexWriter and leave it open forever, using it to index/delete
documents, and periodically calling IW.commit when you need durability.

Create a SearcherManager, passing it the IndexWriter, and use it per-search
to acquire/release the searcher.  Periodically (ideally from a separate
thread) call SM.maybeRefresh so the searcher sees the latest indexing

Mike McCandless

On Tue, Jul 5, 2016 at 9:36 AM, Desteny Child <> wrote:

> Hi,
> In my Spring Boot application I have implemented 2 API endpoints - one for
> Lucene(I use 5.2.1) document indexing and another one for searching.
> Right now I open every time on each request IndexWriter and IndexReader.
> With a big index it works pretty slow.
> I know that there is a possibility to use single IndexWriter  and
> IndexReader in a shared environment. There is SearcherManager or something
> like this for this purpose.
> I can't find a good example for this for Lucene 5. Could you please share
> with me this example ?
> Thanks in advance,
> Alex

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