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 Yousef Ourabi <yo...@gmail.com> on 2005/06/24 21:08:46 UTC
Document ID
Hello:
Is there any way to force the document id inside the lucene index, if
I have my own internal numbering scheme, it would be nice to have that
reflected inside the lucene index...anyway?
IF not is the document ID created on creation or on addition to the
index? And is there a way to retrieve it before it is added to the
index?
Thanks,
Yousef
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Document ID
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
>Is there any way to force the document id inside the lucene index, if
>I have my own internal numbering scheme, it would be nice to have that
>reflected inside the lucene index...anyway?
>
Simply put your ID as additional field to your document. You never
should rely on lucenes document id as it might change due to delete
documents during optimize.
---
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Document ID
Posted by Chris Hostetter <ho...@fucit.org>.
: The simple question - I have a document and I add it into index with
: TermVector support.
: How can I simply retrive the TermVector information for the document?
:
: TermFreqVector vector = reader.getTermFreqVector(document)?
: reader.delete(document);
: Etc..
Open an IndexReader, and either search for the document you want, or use a
TermEnum to seek to it (assuming you have a unique field containing your
own identifier for the data). then use the same IndexReader to get the
TermVector information.
As long as you have that IndexReader open, the internal doc id will be
consistent (for that reader).
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Document ID
Posted by Pasha Bizhan <lu...@lucenedotnet.com>.
Hi,
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> For a domain-centric identifier, use a custom field to store
> (and index perhaps?) it. Lucene's Document id's are internal
> and not controllable.
Unfortunately Lucene contains API that strongly attached to internal id :(
For example - most of the TermVector API or IndexReader.delete()
The simple question - I have a document and I add it into index with
TermVector support.
How can I simply retrive the TermVector information for the document?
TermFreqVector vector = reader.getTermFreqVector(document)?
reader.delete(document);
Etc..
It's not rise a claim. I don't know a good unified solution for this problem
:(
Pasha Bizhan
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Document ID
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 24, 2005, at 3:08 PM, Yousef Ourabi wrote:
> Hello:
> Is there any way to force the document id inside the lucene index, if
> I have my own internal numbering scheme, it would be nice to have that
> reflected inside the lucene index...anyway?
For a domain-centric identifier, use a custom field to store (and
index perhaps?) it. Lucene's Document id's are internal and not
controllable.
> IF not is the document ID created on creation or on addition to the
> index? And is there a way to retrieve it before it is added to the
> index?
The id is created on addition to the index - the id is merely the
position of the document in the index and changes when documents are
deleted before it and the index optimized. Document id's are not to
be relied in the long-term.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org