Hello,
The documentation describes the Xapian C++ API. In general, it applies to PHP
but there is additional documentation for the PHP bindings here :
http://xapian.org/docs/bindings/php/
It seems that this document is not (yet) linked from the xapian /docs/ page but
it is included with the bindings download.
You will find in this documentation the answers to your questions:
- Use Xapian::inmemory_open() to open an inmemory database (section
"Database Factory Functions") :
$xdb_doc = Xapian::inmemory_open();
- get_term()is available for TermIterator and ESetIterator.
(section "Iterator dereferencing")
Hope it helps,
Daniel
> -----Message d'origine-----
> De?: xapian-discuss-bounces at lists.xapian.org [mailto:xapian-discuss-
> bounces at lists.xapian.org] De la part de Andrew Betts
> Envoy??: jeudi 21 octobre 2010 16:33
> ??: xapian-discuss at lists.xapian.org
> Objet?: [Xapian-discuss] In-memory databases vs PHP Bindings
>
> I can't quite connect the dots on this, perhaps someone can help.
I'm
> simply trying to create an in-memory database comprising a single document,
> so that I can run a load of queries against it and see if any of them match
> the new document (this is to enable users to have 'subscriptions'
to saved
> searches and be alerted every time a new item is published that matches
> their search).
>
> However, I can't work out how to create an in-memory database via the
PHP
> bindings. Here's what I've got so far, using a disk-based index
with an
> automatic backend (third line from the end is the critical one):
>
> // Find the document in the posts index
> $xenq = new XapianEnquire($xdb_posts);
> $xenq->set_query(new XapianQuery("UIDpost".$postid));
> $xdoc = $xenq->get_mset(0, 1)->begin()->get_document();
>
> // Create a database that just contains the one document
> // TODO:AB:20101020: Work out how to build an in-memory Xapian database via
> PHP bindings
> $xdb_doc = new
XapianWritableDatabase(PROJROOT.'/tmp/xapian/doc'.$postid,
> Xapian::DB_CREATE_OR_OVERWRITE);
> $xdb_doc->add_document($xdoc);
> $xdb_doc->commit();
>
>
> Also, FYI, the documentation here seems incomplete:
> http://xapian.org/docs/apidoc/html/classXapian_1_1TermIterator.html
>
> I had to inspect the bindings to find the rather useful get_term() method
of
> the TermIterator class! It does mention the use of the * operator to
return
> the current term but I can't see how I'd invoke that in PHP. If
the
> get_term method applies in all environments, it ought to be documented
I'd
> have thought.
>
> Andrew
>
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>
> Email secured by Check Point