Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 41973 invoked from network); 18 Dec 2006 22:07:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Dec 2006 22:07:55 -0000 Received: (qmail 23619 invoked by uid 500); 18 Dec 2006 22:07:54 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 23577 invoked by uid 500); 18 Dec 2006 22:07:54 -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 23548 invoked by uid 99); 18 Dec 2006 22:07:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 14:07:53 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 14:07:45 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E642971429F for ; Mon, 18 Dec 2006 14:07:24 -0800 (PST) Message-ID: <16938873.1166479644940.JavaMail.jira@brutus> Date: Mon, 18 Dec 2006 14:07:24 -0800 (PST) From: "Michael McCandless (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Assigned: (LUCENE-301) Index Writer constructor flags unclear - and annoying in certain cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/LUCENE-301?page=all ] Michael McCandless reassigned LUCENE-301: ----------------------------------------- Assignee: Michael McCandless (was: Lucene Developers) > Index Writer constructor flags unclear - and annoying in certain cases > ---------------------------------------------------------------------- > > Key: LUCENE-301 > URL: http://issues.apache.org/jira/browse/LUCENE-301 > Project: Lucene - Java > Issue Type: Improvement > Components: Index > Affects Versions: 1.4 > Environment: Operating System: other > Platform: Other > Reporter: Dan Armbrust > Assigned To: Michael McCandless > Priority: Minor > > Wouldn't it make more sense if the constructor for the IndexWriter always > created an index if it doesn't exist - and the boolean parameter should be > "clear" (instead of "create") > So instead of this (from javadoc): > IndexWriter > public IndexWriter(Directory d, > Analyzer a, > boolean create) > throws IOException > Constructs an IndexWriter for the index in d. Text will be analyzed with a. > If create is true, then a new, empty index will be created in d, replacing the > index already there, if any. > Parameters: > d - the index directory > a - the analyzer to use > create - true to create the index or overwrite the existing one; false to > append to the existing index > Throws: > IOException - if the directory cannot be read/written to, or if it does not > exist, and create is false > We would have this: > IndexWriter > public IndexWriter(Directory d, > Analyzer a, > boolean clear) > throws IOException > Constructs an IndexWriter for the index in d. Text will be analyzed with a. > If clear is true, and a index exists at location d, then it will be erased, and > a new, empty index will be created in d. > Parameters: > d - the index directory > a - the analyzer to use > clear - true to overwrite the existing one; false to append to the existing > index > Throws: > IOException - if the directory cannot be read/written to, or if it does not > exist. > Its current behavior is kind of annoying, because I have an app that should > never clear an existing index, it should always append. So I want create set to > false. But when I am starting a brand new index, then I have to change the > create flag to keep it from throwing an exception... I guess for now I will > have to write code to check if a index actually has content yet, and if it > doesn't, change the flag on the fly. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org