tony2001                Mon Feb 12 10:52:54 2007 UTC

  Modified files:              
    /phpdoc/en/reference/swish  reference.xml 
  Log:
  more examples
  
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/swish/reference.xml?r1=1.1&r2=1.2&diff_format=u
Index: phpdoc/en/reference/swish/reference.xml
diff -u phpdoc/en/reference/swish/reference.xml:1.1 
phpdoc/en/reference/swish/reference.xml:1.2
--- phpdoc/en/reference/swish/reference.xml:1.1 Fri Feb  9 13:35:21 2007
+++ phpdoc/en/reference/swish/reference.xml     Mon Feb 12 10:52:54 2007
@@ -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>

Reply via email to