lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevor Boicey <tboi...@brit.ca>
Subject Re: existing or not existing
Date Wed, 05 Dec 2001 06:00:35 GMT
Ian Lea wrote:
> 
> Personally, I like to know when I'm creating an index
> so tend to have different code paths, or even different
> classes, for reading and writing indexes.  But how
> about creating the IndexWriter with flag set to false
> and catching the exception it will no doubt throw
> if the index doesn't exist, and reissuing the
> call with the flag set to true?

  This is what I do, but frankly it's a little scary.

  Basically, if your open fails for some other reason, it
blows away your index.

  In my application that's acceptable since my index is
pretty transient, but it's a bit iffy in a lot of situations.

  I think it would make sense to follow the "standard"
of, if that flag is true, to make the index if needed and
use it if it exists.

  The "false" flag could be used to trap exceptions if
the index doesn't exist, and allow the user to perform
other initializations.

  To simply clear the index completely should be another
mechanism that the user would call if they really wanted
to overwrite an index with a new one.

-- 
Trevor Boicey, P. Eng.
Ottawa, Canada, tboicey@brit.ca
ICQ #17432933 http://www.brit.ca/~tboicey/
"There will be no aggressive condiment passing in this house!" - Marge

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message