[Xapian-discuss] WritableDatabase::replace_document and PERL

Eric Parusel eparusel at creativens.com
Sat Aug 20 19:49:45 BST 2005


Olly Betts wrote:
> On Fri, Aug 19, 2005 at 12:00:45PM -0400, Colin B. Thomas wrote:
>>How do I specify that I want the:
>>
>>WritableDatabase::replace_document(const std::string &unique_term, const
>>Xapian::Document &document) implementation
>>
>>As opposed to:
>>
>>WritableDatabase::replace_document(Xapian::docid did, const
>>Xapian::Document &document) implementation
> 
> The former is wrapped as "replace_document_by_term".  Similarly the
> delete_document variant is "delete_document_by_term".
> 
> This isn't documented, except in Changes (and the XS source code).
> I'll fix that.

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...?

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?

I'm currently using libxapian 0.9.0 and Search::Xapian (0.9.0.0) on Perl.
Currently, I do:

my $match = $matches->begin();
my $size  = $matches->size();
while( $size-- ) {
   push (@docids, $match->get_docid);
   $match->inc();
}

Thanks,
Eric



More information about the Xapian-discuss mailing list