Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 29853 invoked from network); 28 Sep 2010 20:29:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Sep 2010 20:29:03 -0000 Received: (qmail 32588 invoked by uid 500); 28 Sep 2010 19:27:02 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 32510 invoked by uid 500); 28 Sep 2010 19:27:01 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 32502 invoked by uid 99); 28 Sep 2010 19:27:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 19:27:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of erickerickson@gmail.com designates 209.85.215.48 as permitted sender) Received: from [209.85.215.48] (HELO mail-ew0-f48.google.com) (209.85.215.48) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 19:26:57 +0000 Received: by ewy10 with SMTP id 10so1163ewy.35 for ; Tue, 28 Sep 2010 12:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=hF7YcW3odwC/DkYrZ9R3FOsz+Utbl2vp59tj43M8O7Q=; b=Xj7KpUL0VGjq13lH2OUCAwANht6ly/ShnsZCkAFeHTHMO/F2qulPJbbZ689sjGdW82 DUsSJrTVbll4jVsGYE984jw09xpuKif9Ru5+HKUnboDK3QDM+ojZ96QAujz7ST3z2cQ9 nMaXdx5CvjCxXUUd5xdE/laQub2sNXURJtAys= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=T2mby5u6/jDknVK9WquXDhu1PlJVp0N3dCgp3xP8WOetdHj33zxXYm3qiLrE2wepJF EG4QulrTE71r1GIMsAGe/wVQoBTod1myZ9La6C4A3CuVdiVchBDNG69oX51zhc9OSn/m nZj/VbK1TO+fafUHJRJPgn2Zn3GURJnwhk8v4= MIME-Version: 1.0 Received: by 10.213.29.79 with SMTP id p15mr1771765ebc.94.1285701994954; Tue, 28 Sep 2010 12:26:34 -0700 (PDT) Received: by 10.220.186.5 with HTTP; Tue, 28 Sep 2010 12:26:34 -0700 (PDT) In-Reply-To: References: <001901cb5d34$92cef3b0$b86cdb10$@thetaphi.de> <004301cb5d9e$91a5cfd0$b4f16f70$@thetaphi.de> Date: Tue, 28 Sep 2010 15:26:34 -0400 Message-ID: Subject: Re: flushing index From: Erick Erickson To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=0015174c1724b27455049156d251 --0015174c1724b27455049156d251 Content-Type: text/plain; charset=ISO-8859-1 Nope, never used jNotify, so I don't have any code handy... Good luck! Erick On Tue, Sep 28, 2010 at 9:38 AM, Yakob wrote: > On 9/28/10, Erick Erickson 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 > > --0015174c1724b27455049156d251--