Doron Cohen wrote:
David <[EMAIL PROTECTED]> wrote on 15/01/2007 00:36:28:

Thanks, I think I did not describe my problem exactly.
What I want to do is:
     if the index file exist, append document
     if the index file does not exist, create a new , empty index file.
How can I implement that?

If this is what you need, this (Lucene Java) conostructor would do:
   IndexWriter(File path, Analyzer a)
          Constructs an IndexWriter for the index in path, creating it
first if it does not already exist, otherwise appending to the existing
index.

But please note these are not yet part of any release (ie, only
committed to the "trunk" right now).

Your current code really cannot work, becuase for FSDirectory.get(),
create=true, which erases everything first, and for IndexWriter(),
create=false, which expects an existing index.

See also JIRA issue LUCENE-773:

    http://issues.apache.org/jira/browse/LUCENE-773

The fact that there are two "create" options (one at the FSDirectory
level and one at the IndexWriter level) has been a source of confusion
/ mistakes / bugs in the past.  So the plan is to deprecate
FSDirectory's create and only use IndexWriter's create going forward.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to