[Xapian-discuss] Updating documents in a database

Olly Betts olly at survex.com
Thu Nov 29 00:48:57 GMT 2007


On Wed, Nov 28, 2007 at 02:23:21PM -0500, Robert Parker wrote:
> I have an existing database of documents, and I'd like to add a value to
> each of the documents without having to recreate the entire database.
> 
> The only way I've thought of to do this is to open the database, get
> each document sequentially, add the relevant value, and then replace the 
> existing version of the document with the upated copy, using the docid.
> 
> Is that my only option, or is there a better way to do it?

That's the only option without recreating the database.

Currently it'll probably be more efficient to recreate the database from
scratch if you have the source data.  This case could be handled a lot
more efficiently (by noticing that the terms and document data are
unchanged) but this optimisation isn't currently done.

Cheers,
    Olly



More information about the Xapian-discuss mailing list