[Xapian-discuss] WritableDatabase::replace_document and PERL

Olly Betts olly at survex.com
Sat Aug 20 23:18:38 BST 2005


On Sat, Aug 20, 2005 at 11:49:45AM -0700, Eric Parusel wrote:
> Olly Betts wrote:
> >The former is wrapped as "replace_document_by_term".  Similarly the
> >delete_document variant is "delete_document_by_term".

> I didn't know this method existed, it could come in handy for myself.
> Are there any performance ramifications to rather storing/"replacing" 
> documents by unique term rather than by docid...?

It's slightly more expensive, but certainly not prohibitively so.
There's some scope for making it more efficient than it currently is
too.  The current implementation is pretty much just the code which
scriptindex used to use, but pushed into the library.

> Also, typically when I do a search I return the list of docids.
> If I was using unique terms rather than docids, how would I return the 
> unique "documentid" ~term~ (eg: "DID:46572.3") for each match?

Store it in the document data.  Or iterate over the terms indexing each
matching document to find the term, which is certainly a reasonable
approach if you're looking at them anyway (for example, to show which
terms in the query match each result).

Cheers,
    Olly



More information about the Xapian-discuss mailing list