Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 30032 invoked from network); 24 Jan 2010 08:27:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jan 2010 08:27:10 -0000 Received: (qmail 30004 invoked by uid 500); 24 Jan 2010 08:27:08 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 29946 invoked by uid 500); 24 Jan 2010 08:27:07 -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 29936 invoked by uid 99); 24 Jan 2010 08:27:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Jan 2010 08:27:07 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chris.lu@gmail.com designates 209.85.211.184 as permitted sender) Received: from [209.85.211.184] (HELO mail-yw0-f184.google.com) (209.85.211.184) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Jan 2010 08:26:58 +0000 Received: by ywh14 with SMTP id 14so2607121ywh.20 for ; Sun, 24 Jan 2010 00:26:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=G1c6GJndWfvL2m+d4GripAUjAJULumQ+D17qMnC7YOc=; b=CqHgqZdcoCkBuiy/xFIUBxAZbrBdSmHdYCcJthGSeRgiOpKsFAjxdysCHcur/QgST+ JIQwMVMLUBq83oqMZDOo5VREiKayVjIrRTgACO1ewgabVFt89sdBcsDtG801oue5NXmx suoIwqFVVzAFPk7jQLmtzB5CMmZ0HXd32PJ2I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=R8ePpnKrnGWjHxfgHvfgBI5aP+Y8J/y/yDjxZOy3Sibz4mwFUedlFPgtIsbEQtmR2u TqY3UOw8XxxbW5VEPLkF+Y+BT9UW2WakrJDlHPhtPk6E5JEpxtIXTXATypL9KDZa/tCY 2aYbYll50GOPGdLWwQYhHAMbiGP9pXG7eVnnc= Received: by 10.101.15.17 with SMTP id s17mr6199045ani.241.1264321596172; Sun, 24 Jan 2010 00:26:36 -0800 (PST) Received: from ?192.168.1.100? (c-71-202-137-93.hsd1.ca.comcast.net [71.202.137.93]) by mx.google.com with ESMTPS id 4sm1352348ywi.9.2010.01.24.00.26.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 24 Jan 2010 00:26:35 -0800 (PST) Message-ID: <4B5C0423.2010208@gmail.com> Date: Sun, 24 Jan 2010 00:26:11 -0800 From: Chris Lu User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: Can't start Lucene App: java.io.FileNotFoundException with brand new directory Content-Type: multipart/alternative; boundary="------------060806060304070307000303" X-Virus-Checked: Checked by ClamAV on apache.org --------------060806060304070307000303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Think from another approach: You can check whether the index exists or not by IndexReader.*indexExists <../../../../org/apache/lucene/index/IndexReader.html#indexExists%28java.io.File%29>*(), and then determine what you want to do with the IndexWriter constructor. -- -- Chris Lu ------------------------- Instant Scalable Full-Text Search On Any Database/Application site: http://www.dbsight.net demo: http://search.dbsight.com Lucene Database Search in 3 minutes: http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes DBSight customer, a shopping comparison site, (anonymous per request) got 2.6 Million Euro funding! jchang wrote: > I figured it out...but the answer leads to a new question. > > The problem was that I was using this constructor: > IndexWriter(Directory d, Analyzer a, boolean create, > IndexWriter.MaxFieldLength mfl) > > I passed in false for create, and if there is no index yet, it fails as I > described. As soon as I pass true for create, the problem goes away. I > guess that makes sense; if you pass false, it expects to find an index > there. > > However, if I pass true, I'll overwrite my existing index (that's what the > javadocs say, and I've found it to be true, generally, although not > always...I can't explain the difference). > > I don't want to overwrite my index every time I start up, but I don't want > to be able to start up with a new, clean index dir. What do I do? > > > jchang wrote: > >> When I try to start my service and construct an IndexWriter, I get this: >> >> java.io.FileNotFoundException: no segments* file found in >> org.apache.lucene.store.NIOFSDirectory@/home/jchang/IdeaProjects/index-service_trunk/target/testindexA/index/indexablemaildata: >> files: [write.lock] >> >> It is odd. The problem is not that it is complaining about a lock file. >> There is none there. It seems to be complaining that there is NOT a lock >> file. Why? The directory is brand new - nothing is it it at all - not >> write.lock file is there. >> >> > > --------------060806060304070307000303--