lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Braun <mbr...@uni-hd.de>
Subject Re: Update index
Date Wed, 23 Aug 2006 08:13:59 GMT
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


Mime
View raw message