Hi All,
I've installed Xapian and the php module. I've set up a script for use
with
scriptindex and dbi2omega for getting data from the db into the index
easily, the script file is as follows:
==============================id : field=id
title : index
title: field=title
description : index
description : truncate=50 field=content
============================
However, when querying the xapian database using the php xapian bindings
like so:
<?php
include "xapian.php";
// Open our xapian database
$db = Xapian::auto_open('/usr/local/lib/omega/data/default');
$enq = new XapianEnquire($db);
// Query for "php" or "mysql"
$enq->set_query(new XapianQuery(XapianQuery::OP_OR, "php",
"mysql"));
// lets grab the matches!
$mset = $enq->get_mset(0, 10);
// output how many estimated
echo 'Matches:
'.$mset->get_matches_estimated().'<br/>';
// Output the terms that matched
$terms = join(' ',
$enq->get_matching_terms($mset->get_hit(0)));
echo 'TERMS: '.$terms.'<br/>';
// Loop the matches and output some data..
for ($i = $mset->begin(); !$i->equals($mset->end()); $i->next())
{
echo '<hr/> Document ID
'.$i->get_docid().'<br/>';
echo $i->get_percent().'% <br/>';
$doc = $i->get_document();
echo $doc->get_data();
}
?>
The echo $doc->get_data() output is as follows:
content=blah blah blah id=1 title=My Title
Is that data accessible via xapian bindings directly i.e. $data->content or
$data->title? Or is my scriptindex wrong or is it my approach that is
flawed?
The examples with PHP are quite limited, but basically I want to have a few
meta data items to be avaliable for output when a search finds an item. Is
that possible?
Ross