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 WATHELET Thomas <th...@europarl.europa.eu> on 2006/08/23 09:49:25 UTC
Update index
Is it possible to update fields in an existing index.
If yes how to proceed.
Re: Update index
Posted by Martin Braun <mb...@uni-hd.de>.
Hi Thomas,
> Is it possible to update fields in an existing index.
> If yes how to proceed.
>
I think you can only delete a document and then reindex the updated
document:
public static int delTitle(String ID) {
try {
return writer.deleteDocuments(new Term("ID",ID));
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}
and then add the new document.
The prerequisite will be that you need a unique Identifier for that
Document to use for the deleteDocuments function (normally you won't
know the lucene's index document-id for the specific doc). The downside
of this is that the lucene-index document-id will change.
hth,
martin
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Update index
Posted by Doron Cohen <DO...@il.ibm.com>.
"WATHELET Thomas" <th...@europarl.europa.eu> wrote on 23/08/2006
00:49:25:
> Is it possible to update fields in an existing index.
> If yes how to proceed.
Unfortunately no.
To update a (document's) field that document must be removed and re-added.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org