lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@blackwell.co.uk>
Subject Re: existing or not existing
Date Tue, 04 Dec 2001 16:59:15 GMT
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?



--
Ian.
ian.lea@blackwell.co.uk


Otis Gospodnetic wrote:
> 
> You could try looking for a segments file in the index directory.
> If it exists, the index exists, else it does not.
> 
> Is there a better way?
> 
> Otis
> 
> --- jean-christian.gagne@prasahewitt.ch wrote:
> >
> >
> > Hi there,
> >
> > I'm testing Lucene after reading a good article on it on JavaWorld.
> >
> > Lucene seems quite simple and very powerful, but there's something I
> > can't get.
> > The first time an application uses an index, this one doesn't exist
> > yet, so the
> > boolean argument of the IndexWriter constructor must be true
> > (creating a new
> > empty index). Next time the same app is started, I want to use the
> > existing
> > index, the boolean argument must be false. Here is my question : how
> > do I know
> > wether the index exists or not ??  Is there a way to create an
> > IndexWriter on a
> > given index, creating it only if needed ?
> >
> > It seems like a stupid question, I must have missed something...
> >
> > Thanks

--
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