[Xapian-discuss] Perl bindings: get_mset

John Wang johncwang at gmail.com
Fri Oct 28 18:02:24 BST 2005


Just wanted to mention something about the Perl bindings.

It seems like when using $enq->matches($start,$size) you don't get access to
other mset methods such as
$mset->get_matches_estimated. I didn't want to call
$enq->matches($start,$size) and $enq->get_mset($start,$size) since that
would be running the query twice so I ended up pulling the code for matches
out of enq and doing tie in my code:

my $enq = $xdb->enquire($qp->parse_query($qry));
my $mset = $enq->get_mset($start,$size);
my @matches;
tie( @matches, 'Search::Xapian::MSet::Tied', $mset );

foreach my $match ( @matches ) {
my $doc = $match->get_document();
printf "ID %d %d%% [ %s ]\n", $match->get_docid(), $match->get_percent(),
$doc->get_data();
}

Is there a better way to iterate through the matches returned by get_mset
(using MSetIterator)?

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.tartarus.org/pipermail/xapian-discuss/attachments/20051028/8d4cd089/attachment.htm


More information about the Xapian-discuss mailing list