Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 17563 invoked from network); 9 May 2006 14:57:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 May 2006 14:57:31 -0000 Received: (qmail 3540 invoked by uid 500); 9 May 2006 14:57:28 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 3426 invoked by uid 500); 9 May 2006 14:57:27 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 3415 invoked by uid 99); 9 May 2006 14:57:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 07:57:27 -0700 X-ASF-Spam-Status: No, hits=2.1 required=10.0 tests=HTML_MESSAGE,INFO_TLD,RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of wenjie.zheng@gmail.com designates 66.249.92.170 as permitted sender) Received: from [66.249.92.170] (HELO ug-out-1314.google.com) (66.249.92.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 07:57:26 -0700 Received: by ug-out-1314.google.com with SMTP id y2so1948550uge for ; Tue, 09 May 2006 07:57:05 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=LMvxfKOdCUuDorka9y2ZJEWFoA79KYzCbCF8yrTOvWB53iVfPEQzsmm0Q9DvQei8c6MO1Ztz75y4QF75JWpaUptwL8LeTy81HlDMzqHmWCr3e0Shjh+/kGA5sf4BovHGLhJ/BK/0sOLfuCg9KKcnn80FpcXnpPCGEmxBUq8echM= Received: by 10.78.24.12 with SMTP id 12mr818066hux; Tue, 09 May 2006 07:57:05 -0700 (PDT) Received: by 10.78.23.3 with HTTP; Tue, 9 May 2006 07:57:05 -0700 (PDT) Message-ID: Date: Tue, 9 May 2006 10:57:05 -0400 From: "wenjie zheng" To: java-dev@lucene.apache.org Subject: Re: weird behavior of IndexReader.indexExists() In-Reply-To: <20060509142655.21036.qmail@web50302.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_52760_21729461.1147186625016" References: <20060509142655.21036.qmail@web50302.mail.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_52760_21729461.1147186625016 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I am a little bit confused here. Since I didn't change the lock directory or disable locking and it is on th= e single server sharing same fs, does it mean I am not supposed to get the error? But I did get the error. What should I do? Wenjie On 5/9/06, Otis Gospodnetic wrote: > > If you don't explicitly change the lock directory and do not disable > locking, the same directory should be used. I'm assuming this is all don= e > on a single server sharing the same file system. The locks are stored in > the system's default temporary directory. That's typically /tmp under > UNIX/OSX and C:\WINDOWS\TEMP (I think) on Winblows. > > Otis > > ----- Original Message ---- > From: wenjie zheng > To: java-dev@lucene.apache.org > Sent: Tuesday, May 9, 2006 9:09:47 AM > Subject: Re: weird behavior of IndexReader.indexExists() > > Thanks, > I guess my question is how to make sure both instances are using the same > lock directory. > > Wenjie > > On 5/9/06, Vanlerberghe, Luc wrote: > > > > Make sure both instances are using the same lock directory. > > The segments file should only be read or written while holding the > > commit lock. > > > > If the lock directories don't match, you'll get more 'strange' errors..= . > > > > In Lucene 1.4.2 some methods did not use the lock, this has been patche= d > > a couple of months ago. > > > > Luc > > > > -----Original Message----- > > From: Andy Hind [mailto:andy.hind@alfresco.org] > > Sent: dinsdag 9 mei 2006 13:47 > > To: java-dev@lucene.apache.org > > Subject: RE: weird behavior of IndexReader.indexExists() > > > > Hi > > > > I think I have discovered this too. > > It is on my list of issues to raise .... > > > > The index exist test looks for the segment file. > > When the index is committing, and you are unlucky, this file may not be > > found as the new segments file replaces the old one. The result is the > > index appears not to exist. > > > > Regards > > > > Andy > > > > -----Original Message----- > > From: wenjie zheng [mailto:wenjie.zheng@gmail.com] > > Sent: 08 May 2006 18:57 > > To: java-dev@lucene.apache.org > > Subject: Re: weird behavior of IndexReader.indexExists() > > > > This happens sometimes when number of docs is over 2000. So it's kinda > > of > > random. > > > > Wenjie > > > > On 5/8/06, wenjie zheng wrote: > > > > > > I created an index with more than 30,000 text files. > > > I used indexExists() to determine either to create a new index or to > > add > > > docs to the existing index. > > > > > > But when the num of docs in the index was over 3,000 (sometimes 3,400= , > > > sometimes 3,200), the indexExists function returns false, so I ended > > up > > > recreating a new index. > > > > > > Here is my code: > > > if index exists, we will add files to it, otherwise, create a new > > index. > > > In either case, an IndexingThread will be spawn to do that. > > > if(IndexReader.indexExists(indexDir)){ > > > logger.info("Working on existing index ..."); > > > IndexingThread.startIndexingThread(Username, new > > > File(propsFile), new File(indexDir), docs, > > > new StandardAnalyzer(), false); > > > }else{ > > > logger.info("Create a new index ..."); > > > IndexingThread.startIndexingThread(Username, new > > > File(propsFile), new File(indexDir), docs, > > > new StandardAnalyzer(), true); > > > } > > > > > > > > > inside the startIndexingThread function, I am calling the following > > > function to add files to the index: > > > /** > > > * Add an array of Files to an index > > > * > > > * @param propsFile the properties file > > > * @param indexDir the folder where index files will be created > > in > > > * @param docs an array of Files to be add to the index > > > * @param analyzer any Analyzer object > > > */ > > > public void addFiles(File propsFile, File indexDir, File[] docs, > > > Analyzer analyzer, boolean overwrite) throws Exception { > > > Properties props =3D new Properties(new > > FileInputStream(propsFile)); > > > > > > if(overwrite || IndexReader.indexExists(indexDir)){ //either > > > overwrite or working on an existing index > > > Directory index =3D FSDirectory.getDirectory(indexDir, > > > overwrite); > > > IndexWriter writer =3D new IndexWriter(index, analyzer, > > > overwrite); > > > > > > FileIndexer indexer =3D new FileIndexer(props); > > > > > > long start =3D new Date().getTime(); > > > indexer.index(writer, docs); > > > writer.optimize(); > > > writer.close (); // close the writer > > > index.close(); // close the index Directory > > > long end =3D new Date().getTime(); > > > > > > logger.info("Total time: " + (end - start) + " ms"); > > > > > > }else{ > > > logger.error("Index files are not found: " + > > > indexDir.getAbsolutePath() + ", overwrite =3D false"); > > > } > > > } > > > > > > Thanks, > > > Wenjie > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org > > For additional commands, e-mail: java-dev-help@lucene.apache.org > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org > > For additional commands, e-mail: java-dev-help@lucene.apache.org > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-dev-help@lucene.apache.org > > ------=_Part_52760_21729461.1147186625016--