lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Gray <>
Subject Re: Updating index if there is a database changes
Date Thu, 04 May 2006 00:11:22 GMT
Hi Kirin,

Once you've updated an index using IndexWriter or IndexReader you just need 
to close and re-open your IndexSearcher so that searching includes the 
changes. There is a great library callled LuceIndexAccessor at the link 
below that manages this for you. It creates an IndexReader/Writer/Searcher 
and hands out references to classes that need to use them. When you want to 
read/write you just get a reference to the appropriate object from the 
index accessor, then release it when you've finished. If you make changes 
using an IndexWriter then release the reference, it waits until all 
IndexSearcher refs have been released, then recreates the searcher 

The link is:

You might also like to look at DelayCloseIndexSearcher at


At 05:31 PM 3/05/2006, you wrote:
>Hi all,
>I m working on a project where I will use lucene to make a search engine on
>a database. I am new to lucene. I wrote a test program which indexes a table
>and searches the same.. but now I m stuck on how to update the index in case
>a database change occurs.. I need some help on this how do I
>update the index at run time... can it be done then and there...or do I have
>to write some kind of schedular program which "re-builds" the entire index
>say once in a day ... which will be more efficient ?
>the data will be huge... 4 million records something..
>Thanks in advance,
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Stephen Gray
Archive Research Officer
Australian Social Science Data Archive
18 Balmain Crescent (Building #66)
The Australian National University
Canberra ACT 0200

Phone +61 2 6125 2185
Fax +61 2 6125 0627

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