[Xapian-discuss] PHP and Enquire_get_eset
InsaneToucan
insanetoucan at gmail.com
Fri Dec 15 07:35:03 GMT 2006
The Enquire object seems to disappear on me...
$ php simplesearch.php /var/data/xapian "php"
Performing query `Xapian::Query(php)'
8 results found
ID 1 100% [<?PHP]
Fatal error: Call to a member function get_eset() on a non-object in
simplesearch.php on line 56
print MSet_get_matches_estimated($matches) . " results found\n";
$mseti = MSet_begin($matches);
while (! MSetIterator_equals($mseti, MSet_end($matches))) {
print "ID " . MSetIterator_get_docid($mseti) . " " .
MSetIterator_get_percent($mseti) . "% [" .
Document_get_data(MSetIterator_get_document($mseti)) . "]\n";
$rset = new XapianRSet();
$rset->add_document(MSetIterator_get_docid($mseti));
$eset = $enquire->get_eset(10, $rset);
MSetIterator_next($mseti);
}
Line 56 is (as you may suspect): $eset = $enquire->get_eset(10, $rset);
Cheers,
InsaneToucannnnnnnn
On 12/14/06, Olly Betts <olly at survex.com> wrote:
>
> On Thu, Dec 14, 2006 at 04:17:18PM -0600, InsaneToucan wrote:
> > 44 Enquire_set_query($enquire, $query);
> > 45 $matches = Enquire_get_mset($enquire, 0, 10);
> > 46 $e = Enquire_get_eset($enquire,1,10,0,1,null);
>
> This style of calling is deprecated (but I failed to update the
> examples for 0.9.9).
>
> But the main thing wrong here is that the second proper argument needs
> to be an RSet, but you're passing "10". There's also no need to pass
> in the default values for all the different optional parameters. You
> want some code like this:
>
> $rset = new XapianRSet();
> // Now add at least one docid to $rset like so:
> $rset->add_document($matches->begin()->get_docid());
> $eset = $enquire->get_eset(10, $rset);
>
> Cheers,
> Olly
>
More information about the Xapian-discuss
mailing list