lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lu <chris...@gmail.com>
Subject Re: Can't start Lucene App: java.io.FileNotFoundException with brand new directory
Date Sun, 24 Jan 2010 08:26:11 GMT
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.
>>
>>     
>
>   

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message