[Xapian-discuss] Setting self-defined doc ID with PHP bindings

Yannick Warnier ywarnier at beeznest.org
Wed Feb 6 15:34:38 GMT 2008


Hello,

I've finally started playing with Xapian in a small test application
designed with CakePHP, so I've also started running into small practical
problems.

I would like to have a one-to-one relationship between a document
indexed in Xapian and a database table containing the full list of
documents (and details about them to access them from inside my web
application).

I've found some comments about that dating from some time ago, saying
that one should use the XapianWritableDatabase::replace_document()
method rather than the XapianWritableDatabase::add_document(), so that I
can add the document ID myself (being numeric and auto-incremented, I
don't suppose that would create a problem, would it?)

However, if that seems to work well (I get no error message), I have no
idea how to check if my document was indexed using the right ID (is
there some command-line tool to check the list of documents in my
database?).

Also, there seems to be no way (as far as the PHP bindings are
concerned) to get this document ID back from search results. I actually
do get search results, but the PHP print_r() function isn't very helpful
with the contents of an mset or one document out of an mset, as it
always give me a "Resource" output.

I have tried a 
  $mset->get_document()->get_data();
and a
  $mset->get_document()->get_docid();
but neither of these seem to work.

Could someone hint me to the right way of doing this please? (and
possibly answer the side-questions as well)

Thanks,

Yannick




More information about the Xapian-discuss mailing list