[Xapian-discuss]
PHP indexing, what's the PHP method for indexscript
athlon athlonf
athlonkmf at yahoo.com
Tue Jan 15 21:04:10 GMT 2008
Currently I have the following indexscript:
pid : unique=Q boolean=Q field=pid
postdate : field=startdate
author_name: unhtml boolean=XAUTHORNAME field=author
author_id: boolean=XAUTHORID field=authorid
url : field=url
sample : weight=1 index field=sample
How can I create the same indexing using PHP?
With this, I can get an searchable index, but I have no idea how to set the fields, so that I can actually GET something back (with the underneath code, I just get a bunch of pid's back).
$doc = new XapianDocument();
$doc->set_data($postrow['pid']);
$doc->add_value(1,date('Ymd',$postrow['postdate']));
$doc->add_value(2,$postrow['author_id']);
$doc->add_term("XAUTHORID".$postrow["author_id"]);
$doc->add_term("XAUTHORNAME".$postrow["forum_id"]);
$indexer->set_document($doc);
$indexer->index_text($postrow['post']); //post == sample
// Add the document to the database.
$database->add_document($doc);
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the Xapian-discuss
mailing list