* Moving hardcoded styles into CSS.
[lhc/web/wiklou.git] / includes / SearchMySQL3.php
index d6b1b7e..948c97b 100644 (file)
@@ -72,7 +72,9 @@ class SearchMySQL3 extends SearchEngine {
                        }
                }
                if ( 0 == count( $this->searchTerms ) ) {
-                       return null;
+                       # No searchable terms remaining.
+                       # We have to return a term for the query or we get an SQL error.
+                       return "0";
                }
 
                return '(' . $cond . ' )';
@@ -80,12 +82,13 @@ class SearchMySQL3 extends SearchEngine {
 
        function queryMain( $filteredTerm, $fulltext ) {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
-               $page = $this->db->tableName( 'page' );
-               $text = $this->db->tableName( 'text' );
+               $page        = $this->db->tableName( 'page' );
+               $revision    = $this->db->tableName( 'revision' );
+               $text        = $this->db->tableName( 'text' );
                $searchindex = $this->db->tableName( 'searchindex' );
                return 'SELECT page_id, page_namespace, page_title, old_flags, old_text ' .
-                       "FROM $page,$text,$searchindex " .
-                       'WHERE page_id=si_page AND page_latest=old_id AND ' . $match;
+                       "FROM $page,$revision,$text,$searchindex " .
+                       'WHERE page_id=si_page AND page_latest=rev_id AND rev_text_id=old_id AND ' . $match;
        }
 
        function update( $id, $title, $text ) {