lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakob <jacob...@opensuse-id.org>
Subject Re: flushing index
Date Tue, 28 Sep 2010 13:38:54 GMT
On 9/28/10, Erick Erickson <erickerickson@gmail.com> wrote:
> Flushing an index to disk is just an IndexWriter.commit(), there's nothing
> really special about that...
>
> About running your code continuously, you have several options:
> 1> schedule a recurring job to do this. On *nix systems, this is a cron job,
> on Windows systems there's a job scheduler.
> 2> Just start it up in an infinite loop. That is, your main is just a
> while(1){}.
> you'll probably want to throttle it a bit, that is run, sleep for some
> interval
> and start again.
> 3> You can get really fancy and try to put some filesystem hooks in that
> notify you when anything changes in a directory, but I really wouldn't go
> there.
>
> Note that you'll have to keep some kind of timestamp (probably in a separate
> file or configuration somewhere) that you can compare against to figure out
> whether you've already indexed the current version of the file.
>
> The other thing you'll have to worry about is deletions. That is, how do you
> *remove* a file from your index if it has been deleted on disk? You may have
> to ask your index for all the file paths.
>
> You want to think about storing the file path NOT analyzed (perhaps with
> keywordtokenizer). That way you'll be able to know which files to remove
> if they are no longer in your directory. As well as which files to update
> when they've changed.
>
> HTH
> Erick


I think I'll go with the third option, I had found a class that can do
monitoring of certain directory, it's called Jnotify. I am planning of
inserting this class in my code above. can you tell me how to do that?
or maybe you can forward me to any link tutorials that explain how to
include Jnotify in a certain lucene source code. I had search about
Jnotify on google but the tutorials of Jnotify is still a few I guess.

thanks though.

-- 
http://jacobian.web.id

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message