Re: 1.9 RC1

2006-02-19 Thread Nadav Har'El
Dan Armbrust <[EMAIL PROTECTED]> wrote on 17/02/2006 08:50:53
PM:
>...
> Short summary - The Constructor for IndexWriter currently will only
> create an index in a folder if you set the boolean create flag to true.
>   But then, if you want to append to that index, you have to set the
> create flag to false (otherwise it overwrites)
>
> In my use cases, I seldom want to overwrite an index - but I often
> create new ones, and append to existing ones.  Forgetting to switch the
> boolean flag between the initial create and the append causes data loss.

Hi,

I agree: as a new user of Lucene, the first thing I wanted to do in my
program
was to open an existing index, or if one doesn't yet exist, create it. I
found
it very strange that this natural usage pattern wasn't naturally supported
by
Lucene. I ended up doing something complex like opening the index once with
create=false, and if that failed, try again with create=true, although this
had
additional problems like trying to recreate the index when we actually got
an
error which was not caused by a non-existant index.

So I'm not sure the solution is to change the semantics of the existing
constructor, but I think Lucene definitely need a new constructor or
convenience
function that will do "the right thing" for opening a potentially-existing
index.

--
Nadav Har'El.


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



Re: 1.9 RC1

2006-02-19 Thread Tatu Saloranta
--- Nadav Har'El <[EMAIL PROTECTED]> wrote:

> Dan Armbrust <[EMAIL PROTECTED]> wrote
> on 17/02/2006 08:50:53
> PM:
...
> So I'm not sure the solution is to change the
> semantics of the existing
> constructor, but I think Lucene definitely need a
> new constructor or
> convenience
> function that will do "the right thing" for opening
> a potentially-existing
> index.

Or maybe get away from the vanilla constructor
mindset, and add more explicitly named factory
methods? Perhaps something like
IndexWriter.openOrCreate(), create() and open() (first
similar to append methods in streams, second for
overwrite, third for opening only if one exists). And
internally constructor could take set of arguments().

I mean, this same thing is done for Field(), with
somewhat improved construction semantics (although
semantics of Field object are bit messy, bundling both
field definition and value).

-+ Tatu +-



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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