Thanks, Jens. Seems like this would be pretty complicated. 

It seems the best way would be not have a separate daemon for indexing 
modifiied documents, but just have the reindexing part in the backend itself 
(it would know when any documents were modifiied), but since it would involve 
some code/design change, I thought I should first find out if there was any way 
I could lessen the work.

Venu


-----Original Message-----
From: Jens Kraemer [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 13, 2006 7:19 PM
To: java-user@lucene.apache.org
Subject: Re: Keeping RAMDirectory and filesystem index in sync


On Mon, Mar 13, 2006 at 06:23:10PM +0530, Satuluri, Venu_Madhav wrote:
> Hi,
> 
> Is there an elegant way to keep RAMDirectory and my file-system based
> index in sync? I have a java class that is periodically started up by
> crond that checks for modified documents and then reindexes them onto
> the filesystem. However, for searching I want to use RAMDirectory (for
> the performance benefits). The process that searches is alive all the
> time (its in the backend of a webapp), and is different from the process
> that indexes. 

You could somehow (HTTP, Database flag, some messaging system) ping your 
backend from your Indexing process, once it's finished. 
The Searching process then would have to re-open it's RAMDirectory. 

Or you check the version of the fs-based index from time to time, to see
when it has changed. Using IndexReader.getCurrentVersion (path_to_index)
this shouldn't be too expensive. But there's the risk that you re-open
your RAMDirectory in the middle of an index update, since the version 
changes on every single modification done to the index.

I don't know of any more elegant ways.

Jens



-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to