more examples

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@229605 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Antony Dovgal 2007-02-12 10:52:54 +00:00
parent 50c0f51dcd
commit 0a5c608389

View file

@ -1,5 +1,5 @@
<?xml version = '1.0' encoding = 'iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<!-- Purpose: -->
<!-- Membership: pecl -->
<reference id="ref.swish" >
@ -38,6 +38,60 @@
&reftitle.runtime;
&no.config;
</section>
<section id="swish.examples">
&reftitle.examples;
<para>
<example>
<title>Basic search query</title>
<programlisting role="php">
<![CDATA[
<?php
try {
$swish = new Swish("index.swish-e");
$results = $swish->query("test OR text");
echo "Found ", $results->hits, " results\n";
while ($result = $results->nextResult()) {
var_dump($result);
break; //break after the first result
}
} catch (SwishException $e) {
echo "Error: ", $e->getMessage(), "\n";
}
?>
]]>
</programlisting>
</example>
</para>
<para>The above example will output something like this:</para>
<screen>
<![CDATA[
Found 9 results
object(SwishResult)#3 (8) {
["swishreccount"]=>
int(1)
["swishrank"]=>
int(1000)
["swishfilenum"]=>
int(10)
["swishdbfile"]=>
string(13) "index.swish-e"
["swishdocpath"]=>
string(23) "README.SUBMITTING_PATCH"
["swishtitle"]=>
NULL
["swishdocsize"]=>
int(4557)
["swishlastmodified"]=>
int(1072136752)
}
]]>
</screen>
</section>
&reference.swish.constants;
&reference.swish.classes;
</partintro>