[Xapian-discuss] Remove terms from a database

Olly Betts olly at survex.com
Sun Nov 9 16:10:46 GMT 2008

On Mon, Nov 03, 2008 at 08:52:49AM -0500, Yannick Warnier wrote:
> Le lundi 03 novembre 2008 à 00:50 -0500, Yannick Warnier a écrit :
> > I've got a semi-production database just a little screwed up (not
> > completely, so I can't really remove everything and start over again),
> > which I am using on a Debian system with the PHP5 bindings.
> > 
> > As I would like to remove terms that are supposedly unused and remove
> > some of the terms actually used but input by mistake at the beginning, I
> > am looking into ways to do that.
> I'm going to add that I know of the e-mail of Marco a few days ago (as
> I'm working with him) and of the fact that 1.0.8 should fix the problem,
> but we are not able to do that at this time (so the original question
> being "is there any tool to do that?" was taking it into account) ;-)

Are you saying that your database is corrupted by the bug which was
fixed in 1.0.8?

If so, you should be able to make a valid database from it using
copydatabase (one of the xapian-core examples).

You can remove all databases with mention the term "foo" from PHP with:


There's no built-in way to remove all mentions of a term without also
removing all the documents which mention the term - you'd have to
iterate all the documents indexed by the term, get each document, call
Document::remove_term() and then WritableDatabase::replace_document().


More information about the Xapian-discuss mailing list