lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <>
Subject Re: Beginner's questions
Date Wed, 27 Mar 2013 15:37:01 GMT
Hi Paul,

On Wed, Mar 27, 2013 at 1:58 PM, Paul Bell <> wrote:
> As to the ideas raised in the links you pointed me to: the first link shows
> the instantiation of a Term object via
>    writer.UpdateDocument(new Term("IDField", *id*), doc);
> yet in the 4.2.0 docs I see no Term constructor that allows this "id"
> field.

I think this is this one:,

> But this raises an interesting question: is it possible to tell Lucene that
> the Document I've given it to index has a specific identifier? Here's an
> example of what I mean. Suppose that the DB in question is a NoSQL type of
> the graph flavor. I add a vertex to that graph. The vertex contains some
> properties, e.g., name and type, whose values are text strings. I want
> Lucene to index these data AND I want to know some kind of identifier for
> that vertex Document. I would prefer to give Lucene that ID, though I might
> be able to tolerate it giving it to me.

Lucene has no schema that would allow you to specify a primary key,
but there is the IndexWriter.updateDocument method that allows for
atomic updates of documents:,

You just need to pass a term where the field name is the name of your
primary key field and the value is the actual ID.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message