You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Akshay <ak...@gmail.com> on 2009/02/11 16:51:44 UTC

Creation of index for the first time

Hi List,

How to find if an empty lucene index has been created for the very first
time? Is the generation number 1 enough to determine this?

-- 
Regards,
Akshay K. Ukey.

Re: Creation of index for the first time

Posted by Michael McCandless <lu...@mikemccandless.com>.
Akshay wrote:

> The use case is in context of replication. The master has a newly  
> created
> empty index. When slave requests for data, don't do anything if its  
> a newly
> created index.

OK.

Hmm, but would master need to tell slave "I created a new index", even  
if
new index happen to be created in a location that previously held an  
index?
(Note: I know very little about replication, so maybe this could  
easily be out
of bounds).

>> What exactly do you mean by "fresh index created for the first time"?
>>
>> Ie, does opening an IndexWriter with create=true over a Directory  
>> that
>> previously had a Lucene index not count as "fresh" for some reason?
>
>
> Yes this didn't count as fresh for my question, sorry for not being  
> clear.
> Thanks.

OK then it sounds like generation==1 is the test you want.

Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Creation of index for the first time

Posted by Akshay <ak...@gmail.com>.
The use case is in context of replication. The master has a newly created
empty index. When slave requests for data, don't do anything if its a newly
created index.
On Wed, Feb 11, 2009 at 11:17 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> What exactly do you mean by "fresh index created for the first time"?
>
> Ie, does opening an IndexWriter with create=true over a Directory that
> previously had a Lucene index not count as "fresh" for some reason?


Yes this didn't count as fresh for my question, sorry for not being clear.
Thanks.


>  (If so, then it sounds like generation==1 is the test you want).
>
> What's the use case behind this?
>
> Mike
>
>
> Akshay wrote:
>
>  Is there a way, without the knowledge of how IndexWriter was used, by
>> which
>> we can say that an empty index currently open is a really fresh index
>> created for the first time?
>>
>> Thanks.
>>
>> On Wed, Feb 11, 2009 at 9:54 PM, Michael McCandless <
>> lucene@mikemccandless.com> wrote:
>>
>>
>>> If you create IndexWriter with create=true in a directory that has no
>>> Lucene index, segments_1 is created.
>>>
>>> If you do the same, but in a directory that already has a Lucene index,
>>> segments_(N+1) is created (where N was the last generation of the current
>>> index in that directory).
>>>
>>> But... this is an internal detail to Lucene's index format and could
>>> change
>>> in some future release.
>>>
>>> Mike
>>>
>>>
>>> Akshay wrote:
>>>
>>> Hi List,
>>>
>>>>
>>>> How to find if an empty lucene index has been created for the very first
>>>> time? Is the generation number 1 enough to determine this?
>>>>
>>>> --
>>>> Regards,
>>>> Akshay K. Ukey.
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>>
>>
>> --
>> Regards,
>> Akshay K. Ukey.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Regards,
Akshay K. Ukey.

Re: Creation of index for the first time

Posted by Michael McCandless <lu...@mikemccandless.com>.
What exactly do you mean by "fresh index created for the first time"?

Ie, does opening an IndexWriter with create=true over a Directory that  
previously had a Lucene index not count as "fresh" for some reason?   
(If so, then it sounds like generation==1 is the test you want).

What's the use case behind this?

Mike

Akshay wrote:

> Is there a way, without the knowledge of how IndexWriter was used,  
> by which
> we can say that an empty index currently open is a really fresh index
> created for the first time?
>
> Thanks.
>
> On Wed, Feb 11, 2009 at 9:54 PM, Michael McCandless <
> lucene@mikemccandless.com> wrote:
>
>>
>> If you create IndexWriter with create=true in a directory that has no
>> Lucene index, segments_1 is created.
>>
>> If you do the same, but in a directory that already has a Lucene  
>> index,
>> segments_(N+1) is created (where N was the last generation of the  
>> current
>> index in that directory).
>>
>> But... this is an internal detail to Lucene's index format and  
>> could change
>> in some future release.
>>
>> Mike
>>
>>
>> Akshay wrote:
>>
>> Hi List,
>>>
>>> How to find if an empty lucene index has been created for the very  
>>> first
>>> time? Is the generation number 1 enough to determine this?
>>>
>>> --
>>> Regards,
>>> Akshay K. Ukey.
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
>
> -- 
> Regards,
> Akshay K. Ukey.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Creation of index for the first time

Posted by Akshay <ak...@gmail.com>.
Is there a way, without the knowledge of how IndexWriter was used, by which
we can say that an empty index currently open is a really fresh index
created for the first time?

Thanks.

On Wed, Feb 11, 2009 at 9:54 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> If you create IndexWriter with create=true in a directory that has no
> Lucene index, segments_1 is created.
>
> If you do the same, but in a directory that already has a Lucene index,
> segments_(N+1) is created (where N was the last generation of the current
> index in that directory).
>
> But... this is an internal detail to Lucene's index format and could change
> in some future release.
>
> Mike
>
>
> Akshay wrote:
>
>  Hi List,
>>
>> How to find if an empty lucene index has been created for the very first
>> time? Is the generation number 1 enough to determine this?
>>
>> --
>> Regards,
>> Akshay K. Ukey.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Regards,
Akshay K. Ukey.

Re: Creation of index for the first time

Posted by Michael McCandless <lu...@mikemccandless.com>.
Noble Paul നോബിള്‍ नोब्ळ् wrote:

> is it reasonable to assume that the generation of a commit point is
> always '1' when an empty index is opened?

It depends what "empty index" means.

EG I can make a new index, add docs, do lots of commits, etc., then
open a new IndexWriter with create=true on that same Directory.  At
that point I have an "empty index" (no docs), but its generation is > 1.

Or if by empty index you mean zero files in the Directory, then when
I make an IndexWriter w/ create=true and immediately close it, then
generation will always be 1.

Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Creation of index for the first time

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
is it reasonable to assume that the generation of a commit point is
always '1' when an empty index is opened?

On Wed, Feb 11, 2009 at 9:54 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
>
> If you create IndexWriter with create=true in a directory that has no Lucene
> index, segments_1 is created.
>
> If you do the same, but in a directory that already has a Lucene index,
> segments_(N+1) is created (where N was the last generation of the current
> index in that directory).
>
> But... this is an internal detail to Lucene's index format and could change
> in some future release.
>
> Mike
>
> Akshay wrote:
>
>> Hi List,
>>
>> How to find if an empty lucene index has been created for the very first
>> time? Is the generation number 1 enough to determine this?
>>
>> --
>> Regards,
>> Akshay K. Ukey.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>



-- 
--Noble Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Creation of index for the first time

Posted by Michael McCandless <lu...@mikemccandless.com>.
If you create IndexWriter with create=true in a directory that has no  
Lucene index, segments_1 is created.

If you do the same, but in a directory that already has a Lucene  
index, segments_(N+1) is created (where N was the last generation of  
the current index in that directory).

But... this is an internal detail to Lucene's index format and could  
change in some future release.

Mike

Akshay wrote:

> Hi List,
>
> How to find if an empty lucene index has been created for the very  
> first
> time? Is the generation number 1 enough to determine this?
>
> -- 
> Regards,
> Akshay K. Ukey.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org