Hi KK,

Easier still, you could just open the indexwriter with the last (3rd)
arguement as true, this way the indexwriter would create a new index as soon
as you start indexing. Also, if you just leave the indexWriter without the
3rd arguement, it'd conditionally create a new directory i.e. only if the
index dir doesn't exist at that location would it create a new index else it
would append to the already existing index at that location.
Coming to the 2nd point, if you are talking about the index name, as
mentioned by John you could simply use the timestamp as the index name.

--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Wed, May 20, 2009 at 3:23 PM, John Byrne <john.by...@propylon.com> wrote:

> You can do this with pure Java. Create a file object with the path you
> want, check if it exists, and it not, create it:
>
> File newIndexDir = new File("/foo/bar")
>
> if(!newFileDir.exists())   {
>
>   newDirFile.mkdirs();
> }
>
> The 'mkdirs()' method creates any necessary parent directories.
>
> If you want to automate the generation of the path itself, then there are
> several ways to do it, but the best way really depends on *why* you're
> generating a new index. For instance, you could just create a timestamped
> name, but that name might not be very meaningful.
>
> Hope that helps!
>
> -John
>
> KK wrote:
>
>> How to create a new index? everytime I need to do so , I've to create a
>> new
>> directory and put the path to that, right? how to automate the creation of
>> new directory?
>>
>> I'm a new user of lucene. Please help me out.
>>
>> Thanks,
>> KK.
>>
>>  ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database:
>> 270.12.35/2123 - Release Date: 05/19/09 17:59:00
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

Reply via email to