[Xapian-discuss] php bindings

John Wards j.wards at sportnetwork.net
Tue Mar 7 13:39:26 GMT 2006


$database = new_Database("/path/to/your/db");
$enquire = new_Enquire($database)
$query_parser = new_queryparser();
queryparser_set_database ($query_parser, $database);
$query = queryparser_parse_query ($query_parser, "my query");

Enquire_set_query($enquire, $query);
$matches = Enquire_get_mset($enquire, $next,20);
$mseti = MSet_begin($matches);

while (! MSetIterator_equals($mseti, MSet_end($matches))) {
    	echo Document_get_data(MSetIterator_get_document($mseti));
	MSetIterator_next($mseti);
}

Hows that to get you started...

On Tue, 2006-03-07 at 19:02 +0530, durga bidaye wrote:
> helo
> 
> i m not concerned with readin input frm a form actually. wat i dnt
> understand in that example is that, nowhere are they "connectin" to a
> database. i mean no commands fr connectin to the quartz DB( like we
> have mysql_connect () to connect to a mysql DB). Is it because quartz
> is not a proper kinda DB? Anyways does the absence of such a
> connecting statement mean that there is no need to explicitly connect
> to the quartz DB thru the server? and does it mean i cant just tweak
> the code a bit( for collectin data frm form input fields) n use it fr
> searchin(simplesearch.php) right away?
> 
> thanks.
> 
> On 3/7/06, Olly Betts <olly at survex.com> wrote:
>         On Tue, Mar 07, 2006 at 06:19:53PM +0530, durga bidaye wrote:
>         > I m a newbie here . i have used xapian with c++. now i wanna
>         use php. i
>         > installed the bindings and went thru the docs. the examples
>         given are
>         > command line ones. i wanna create an application where
>         search string is
>         > taken thru a form, from  a user. i wud like a example of a
>         pgm which runs
>         > in  the browser( not on the command line).
>         
>         We don't currently have such an example, but reading input
>         from a form 
>         in PHP isn't at all Xapian specific and you can find thousands
>         of
>         examples of how to do it on the web, e.g.:
>         
>         http://www.google.com/search?q=php+form+input
>         
>         > n another doubt i have is whether all the classes that were
>         > available fr C++ are of no use to php? or only a few classes
>         had to be
>         > modified fr bindings pakage? rest of them are available fr
>         use by php? if 
>         > not then where is the description fr classes used in
>         bindings?
>         
>         Did you read the PHP bindings documentation?  See
>         php/docs/bindings.html in xapian-bindings.
>         
>         Pretty much all classes and methods are wrapped in PHP.  SWIG
>         doesn't 
>         currently allow you to make a PHP subclass of a wrapped C++
>         class and
>         pass it into C++, without which a couple of classes (e.g.
>         MatchDecider)
>         are pointless so not wrapped.  And we don't currently wrap the
>         Xapian::Error classes (because PHP4 doesn't support
>         exceptions). 
>         
>         And sometimes a new class/method doesn't get wrapped right
>         away, though
>         I try to keep everything in step.  Generally Java and Perl lag
>         more
>         because it requires more work to add a wrapper for those.
>         
>         If you find a class or method which isn't wrapped and there's
>         not 
>         documented reason, report it and we'll fix the situation.
>         
>         Cheers,
>             Olly
> 
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss




More information about the Xapian-discuss mailing list