lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej Bialecki>
Subject Re: updating existing field values
Date Thu, 07 Aug 2008 20:51:36 GMT
Robert Stewart wrote:
> Given an existing index, is there any way to update the value of a
> particular field across all documents, without deleting/re-indexing
> documents?  For instance, if I have a date field, and I need to
> offset all dates based on change to stored time zone (subtract 12
> hours from each value).  The sort order of field values would not
> change, and the postings should not need to change, only values of
> fields.  I do not believe there is any API to do it, but is there
> some lower level way to do it (modifying files manually)?  I only ask
> because I have a large index and I don't want to re-index all
> documents.

Perhaps you could do this using FilterIndexReader implementation, i.e. 
wrap your original index within this filter and then invoke 
IndexWriter.addIndexes(IndexReader[]). If you override 
FilterIndexReader.document(int, FieldSelector), which retrieves the 
stored fields of a document, then you can change the values of stored 
fields only, just before they are added to the new index. Note that this 
works ONLY for non-indexed fields that are stored (i.e. Store.YES, 
Index.NO) - if a field is both stored and indexed then you need to 
modify the postings too, which requires overriding other methods.

Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration  Contact: info at sigram dot com

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

View raw message