[Xapian-discuss] Easy deletion of documents?
Olly Betts
olly at survex.com
Thu Dec 1 00:36:05 GMT 2005
On Wed, Nov 30, 2005 at 01:55:05PM -0600, Tony Lambiris wrote:
> Is there an easy way to delete, or lookup a docid, then delete out of
> the database? I've been hunting around but came up empty. Basically I
> have a bunch of files, all unique filenames, and some files will become
> "out-of-date" if you will, I just need a simple way of reaching into the
> database and deleting that doc based on the filename.
Just add the filename as a term to each document (with a prefix to
distinguish it from terms from text - "Q" is the usual prefix for
such uniQue terms, but nothing in the core library relies on this.
Then you can directly call delete_document or replace_document with a
termname instead of a document id.
If you have long filenames, beware of the termname length limit. I
don't remember off the top of my head what the precise limit is, but
240 characters is certainly safe.
Omega handles longer terms by truncating and adding a hash of the rest
of the string in this case, which is a simple and robust approach. See
function make_url_term in omindex.cc for details.
Cheers,
Olly
More information about the Xapian-discuss
mailing list