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 Darren Govoni <da...@ontrenet.com> on 2008/08/16 16:39:51 UTC

Get id of Document just added?

Hi,
  I combed through the API and some of the mailing list. I need
to get the id of a Document just added. How should this be done?
I'm using Lucene 2.3.2.

thank you,
Darren


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


Re: Get id of Document just added?

Posted by Darren Govoni <da...@ontrenet.com>.
Yeah, you are right. Was looking for a lazy way to avoid writing 5 lines
of code. Hehe.

Thanks,
Darren


On Sat, 2008-08-16 at 10:44 -0400, Mark Miller wrote:
> Darren Govoni wrote:
> > Hi,
> >   I combed through the API and some of the mailing list. I need
> > to get the id of a Document just added. How should this be done?
> > I'm using Lucene 2.3.2.
> >
> > thank you,
> > Darren
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >   
> The id given by lucene is for internal use and will not remain the same 
> for each document after deletes, merges, etc. You shouldn't need it. Do 
> you really?
> 
> Instead, you should index a field called id and populate it yourself - 
> thats most likely the type of id your looking for.
> 
> - Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 


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


Re: Get id of Document just added?

Posted by Mark Miller <ma...@gmail.com>.
Darren Govoni wrote:
> Hi,
>   I combed through the API and some of the mailing list. I need
> to get the id of a Document just added. How should this be done?
> I'm using Lucene 2.3.2.
>
> thank you,
> Darren
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>   
The id given by lucene is for internal use and will not remain the same 
for each document after deletes, merges, etc. You shouldn't need it. Do 
you really?

Instead, you should index a field called id and populate it yourself - 
thats most likely the type of id your looking for.

- Mark

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