<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,6 @@
 TheyWorkForYou.com Installation Instructions 
 ============================================
-$Id: INSTALL.txt,v 1.7 2008/01/24 15:57:30 matthew Exp $
+$Id: INSTALL.txt,v 1.8 2008/01/24 22:11:36 matthew Exp $
 
 TODO: Add an explanation of how to set up a virtual host in apache.
 
@@ -67,12 +67,11 @@ mysqladmin -u root -p create twfy
 
 grant all on twfy.* to twfy@localhost identified by 'mypass';
 
-4. create database schema. The creation scripts are in the 'db'
+4. create database schema. The creation script is in the 'db'
    subdirectory of the theyworkforyou source code package.
 
 $ cd db
-$ mysql -u twfy -p twfy &lt; hansard.sql
-$ mysql -u twfy -p twfy &lt; users.sql
+$ mysql -u twfy -p twfy &lt; schema.sql
 
 5. Configure the configuration file
 
@@ -160,9 +159,9 @@ you need to compile the PHP bindings of Xapian. If you don't have
 Xapian, you will probably get an error like this when you try to do a
 search:
 
-Fatal error: Call to undefined function: new_stem() in
-/var/www/theyworkforyou/www/includes/easyparliament/searchengine.php
-on line 32
+Fatal error: Class 'XapianStem' not found in
+/.../www/includes/easyparliament/searchengine.php
+on line 39
 
 There are some instructions on how to do this here:
   http://lists.tartarus.org/pipermail/xapian-discuss/2004-May/000037.html</diff>
      <filename>INSTALL.txt</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@ Example usage:
 */
 
 include_once INCLUDESPATH . 'dbtypes.php';
+include_once '/usr/share/php5/xapian.php';
 
 global $xapiandb;
 
@@ -36,7 +37,7 @@ class SEARCHENGINE {
             return null;
 
 		$this-&gt;query = $query;
-        $this-&gt;stemmer = new_stem('english');
+        $this-&gt;stemmer = new XapianStem('english');
         $this-&gt;enquire = null; 
 
         // Any characters other than this are treated as, basically, white space
@@ -232,7 +233,7 @@ class SEARCHENGINE {
 
     // Return stem of a word
     function stem($word) {
-        return stem_stem_word($this-&gt;stemmer, strtolower($word));
+        return $this-&gt;stemmer-&gt;stem_word(strtolower($word));
     }
 
     // Internal use mainly - you probably want query_description.  Converts
@@ -275,28 +276,28 @@ class SEARCHENGINE {
 		$start = getmicrotime();
         global $xapiandb;
         if (!$xapiandb) {
-            $xapiandb = new_database(XAPIANDB);
+            $xapiandb = new XapianDatabase(XAPIANDB);
         }
         if (!$this-&gt;enquire) {
-            $this-&gt;enquire = new_enquire($xapiandb);
+            $this-&gt;enquire = new XapianEnquire($xapiandb);
         }
 
-        $queryparser = new_queryparser();
-        queryparser_set_stemming_strategy($queryparser, QueryParser_STEM_NONE);
-        queryparser_set_default_op($queryparser, Query_OP_AND);
-        queryparser_add_prefix($queryparser, &quot;speaker&quot;, &quot;speaker:&quot;);
-        queryparser_add_prefix($queryparser, &quot;major&quot;, &quot;major:&quot;);
-        queryparser_add_prefix($queryparser, 'date', 'date:');
-        queryparser_add_prefix($queryparser, 'batch', 'batch:');
+        $queryparser = new XapianQueryParser();
+        $queryparser-&gt;set_stemming_strategy(QueryParser_STEM_NONE);
+        $queryparser-&gt;set_default_op(Query_OP_AND);
+        $queryparser-&gt;add_prefix(&quot;speaker&quot;, &quot;speaker:&quot;);
+        $queryparser-&gt;add_prefix(&quot;major&quot;, &quot;major:&quot;);
+        $queryparser-&gt;add_prefix('date', 'date:');
+        $queryparser-&gt;add_prefix('batch', 'batch:');
         twfy_debug(&quot;SEARCH&quot;, &quot;query remade -- &quot;. $this-&gt;query_remade());
         // We rebuild (with query_remade) our query and feed that text string to 
         // the query parser.  This is because the error handling in the query parser
         // is a bit knackered, and we want to be sure our highlighting etc. exactly
         // matches. XXX don't need to do this for more recent Xapians
-        $query = queryparser_parse_query($queryparser, $this-&gt;query_remade());
-        twfy_debug(&quot;SEARCH&quot;, &quot;queryparser description -- &quot; . query_get_description($query));
+        $query = $queryparser-&gt;parse_query($this-&gt;query_remade());
+        twfy_debug(&quot;SEARCH&quot;, &quot;queryparser description -- &quot; . $query-&gt;get_description());
 
-        enquire_set_query($this-&gt;enquire, $query);
+        $this-&gt;enquire-&gt;set_query($query);
 
         // Set collapsing and sorting
         global $PAGE;
@@ -305,16 +306,16 @@ class SEARCHENGINE {
             if ($items[0] == 'groupby') {
                 $collapsed = true;
                 if ($items[1] == 'day') 
-                    enquire_set_collapse_key($this-&gt;enquire, 2);
+                    $this-&gt;enquire-&gt;set_collapse_key(2);
                 else if ($items[1] == 'debate')
-                    enquire_set_collapse_key($this-&gt;enquire, 3);
+                    $this-&gt;enquire-&gt;set_collapse_key(3);
                 else if ($items[1] == 'speech')
                     ; // no collapse key
                 else 
                     $PAGE-&gt;error_message(&quot;Unknown group by '$items[1]' ignored&quot;);
             } elseif ($items[0] == 'bias') {
                 list($weight, $halflife) = explode(&quot;:&quot;, $items[1]);
-                enquire_set_bias($this-&gt;enquire, $weight, intval($halflife));
+                $this-&gt;enquire-&gt;set_bias($weight, intval($halflife));
             } elseif ($items[0] == 'speaker') {
                 # Don't do any collapsing if we're searching for a person's speeches
                 $collapsed = true;
@@ -322,17 +323,17 @@ class SEARCHENGINE {
         }
         // default to grouping by subdebate, i.e. by page
         if (!$collapsed)
-            enquire_set_collapse_key($this-&gt;enquire, 7);
+            $this-&gt;enquire-&gt;set_collapse_key(7);
         
-        $matches = enquire_get_mset($this-&gt;enquire, 0, 500);
+        $matches = $this-&gt;enquire-&gt;get_mset(0, 500);
         // Take either: 1) the estimate which is sometimes too large or 2) the
         // size which is sometimes too low (it is limited to the 500 in the line
         // above).  We get the exact mset we need later, according to which page
         // we are on.
-        if (mset_size($matches) &lt; 500) {
-            $count = mset_size($matches);
+        if ($matches-&gt;size() &lt; 500) {
+            $count = $matches-&gt;size();
         } else {
-            $count = mset_get_matches_estimated($matches);
+            $count = $matches-&gt;get_matches_estimated();
         }
 		$duration = getmicrotime() - $start;
 		twfy_debug (&quot;SEARCH&quot;, &quot;Search count took $duration seconds.&quot;);
@@ -346,33 +347,33 @@ class SEARCHENGINE {
         // NOTE: this is to do sort by date
         switch ($sort_order) {
             case 'date':
-                enquire_set_sorting($this-&gt;enquire, 0, 1);
+                $this-&gt;enquire-&gt;set_sorting(0, 1);
                 break;
             case 'created':
-                enquire_set_sorting($this-&gt;enquire, 6, 1); 
+                $this-&gt;enquire-&gt;set_sorting(6, 1); 
             default:
                 //do nothing, default ordering is by relevance
                 break;
         }
-        $matches = enquire_get_mset($this-&gt;enquire, $first_result, $results_per_page);
+        $matches = $this-&gt;enquire-&gt;get_mset($first_result, $results_per_page);
 		$this-&gt;gids = array();
         $this-&gt;created = array();
 		$this-&gt;relevances = array();
-        $iter = mset_begin($matches);
-        $end = mset_end($matches);
-        while (!msetiterator_equals($iter, $end))
+        $iter = $matches-&gt;begin();
+        $end = $matches-&gt;end();
+        while (!$iter-&gt;equals($end))
         {
-            $relevancy =  msetiterator_get_percent($iter);
-            $weight =  msetiterator_get_weight($iter);
-            $doc = msetiterator_get_document($iter);
-            $gid = document_get_data($doc);
+            $relevancy =  $iter-&gt;get_percent();
+            $weight =  $iter-&gt;get_weight();
+            $doc = $iter-&gt;get_document();
+            $gid = $doc-&gt;get_data();
             if ($sort_order=='created') {
-                array_push($this-&gt;created, document_get_value($doc, 6));
+                array_push($this-&gt;created, $doc-&gt;get_value(6));
             }
 			twfy_debug(&quot;SEARCH&quot;, &quot;gid: $gid relevancy: $relevancy% weight: $weight&quot;);
 			array_push($this-&gt;gids, &quot;uk.org.publicwhip/&quot;.$gid);
 			array_push($this-&gt;relevances, $relevancy);
-            msetiterator_next($iter);
+            $iter-&gt;next();
         }
 		$duration = getmicrotime() - $start;
 		twfy_debug (&quot;SEARCH&quot;, &quot;Run search took $duration seconds.&quot;);
@@ -500,17 +501,17 @@ class SEARCHENGINE {
 // Instead we are now parsing in PHP, and rebuilding something to feed to 
 // query parser.  Yucky but works.
 
-/*        $querydummy = new_query(&quot;dummy&quot;);
-        $query1 = new_query(&quot;ethiopia&quot;);
-        $query2 = new_query(&quot;economic&quot;);
-        #$query = query_querycombine($querydummy, Query_OP_AND, $query1, $query2);
+/*        $querydummy = new XapianQuery(&quot;dummy&quot;);
+        $query1 = new XapianQuery(&quot;ethiopia&quot;);
+        $query2 = new XapianQuery(&quot;economic&quot;);
+        #$query = $querydummy-&gt;querycombine(Query_OP_AND, $query1, $query2);
         $query = new_QueryCombine(Query_OP_AND, $query1, $query2);
 #new_QueryCombine
-#        $query = query_querycombine($query1, Query_OP_OR, $query1, $query2);
+#        $query = $query1-&gt;querycombine(Query_OP_OR, $query1, $query2);
 #        foreach ($this-&gt;words as $word) {
- #           $query = new_query(Query_OP_OR, $query, new_query($word));
+ #           $query = new XapianQuery(Query_OP_OR, $query, new XapianQuery($word));
   #      }
-        print &quot;description:&quot; . query_get_description($query) . &quot;&lt;br&gt;&quot;; */
+        print &quot;description:&quot; . $query-&gt;get_description() . &quot;&lt;br&gt;&quot;; */
 }
 
 global $SEARCHENGINE;</diff>
      <filename>www/includes/easyparliament/searchengine.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>58c1bd2a4bceadce55de645bd57bed50a363b64b</id>
    </parent>
  </parents>
  <author>
    <name>matthew</name>
    <email>matthew</email>
  </author>
  <url>http://github.com/mlandauer/twfy/commit/f12030572fbcfda2f1f9d019753d2f8b592ab062</url>
  <id>f12030572fbcfda2f1f9d019753d2f8b592ab062</id>
  <committed-date>2008-01-24T14:11:36-08:00</committed-date>
  <authored-date>2008-01-24T14:11:36-08:00</authored-date>
  <message>New PHP bindings for Xapian.</message>
  <tree>e7f11cc749a109a6925f793bcc46faf521da50ed</tree>
  <committer>
    <name>matthew</name>
    <email>matthew</email>
  </committer>
</commit>
