lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raf <r.ventag...@gmail.com>
Subject Re: Can't start Lucene App: java.io.FileNotFoundException with brand new directory
Date Sun, 24 Jan 2010 14:23:17 GMT
Hi,
I think you should use another IndexWriter constructor:

IndexWriter(Directory d, Analyzer a, IndexWriter.MaxFieldLength mfl)
          Constructs an IndexWriter for the index in d, first *creating it
if it does not already exist*.

Hope this helps.
Bye

Raf

On Sun, Jan 24, 2010 at 4:48 AM, jchang <jchangkihatest@gmail.com> 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?
>
>
>

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