Don't use the parser cache for non-existent articles
[lhc/web/wiklou.git] / includes / SearchMySQL4.php
index 5e97945..20bbfbc 100644 (file)
  * @subpackage Search
  */
 
+/** */
 require_once( 'SearchEngine.php' );
 
+/**
+ * @package MediaWiki
+ * @subpackage Search
+ */
 class SearchMySQL4 extends SearchEngine {
-       var $strictMatching = false;
+       var $strictMatching = true;
        
+       /** @todo document */
        function SearchMySQL4( &$db ) {
                $this->db =& $db;
        }
-       
+
+       /** @todo document */
        function getIndexField( $fulltext ) {
                return $fulltext ? 'si_text' : 'si_title';
        }
 
+       /** @todo document */
        function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
                $lc = SearchEngine::legalSearchChars();
@@ -70,37 +78,40 @@ class SearchMySQL4 extends SearchEngine {
                return " MATCH($field) AGAINST('$searchon' IN BOOLEAN MODE) ";
        }
 
+       /** @todo document */
        function queryMain( $filteredTerm, $fulltext ) {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
-               $cur = $this->db->tableName( 'cur' );
+               $page        = $this->db->tableName( 'page' );
+               $revision    = $this->db->tableName( 'revision' );
+               $text        = $this->db->tableName( 'text' );
                $searchindex = $this->db->tableName( 'searchindex' );
-               return 'SELECT cur_id, cur_namespace, cur_title, cur_text ' .
-                       "FROM $cur,$searchindex " .
-                       'WHERE cur_id=si_page AND ' . $match;
+               return 'SELECT page_id, page_namespace, page_title, old_flags, old_text ' .
+                       "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 ) {
-                $dbw=& wfGetDB(DB_MASTER);
-                $dbw->replace( 'searchindex', array(array('si_page')),
-                        array(
-                                'si_page' => $id,
-                                'si_title' => $dbw->strencode($title),
-                                'si_text' => $dbw->strencode( $text )
-                        ), 'SearchMySQL4::update' );
-        }
+       /** @todo document */
+    function update( $id, $title, $text ) {
+            $dbw=& wfGetDB(DB_MASTER);
+            $dbw->replace( 'searchindex', array(array('si_page')),
+                    array(
+                            'si_page' => $id,
+                            'si_title' => $title,
+                            'si_text' => $text
+                    ), 'SearchMySQL4::update' );
+    }
 
-        function updateTitle($id,$title) {
-                $dbw=& wfGetDB(DB_MASTER);
-                $lowpri=$dbw->lowPriorityOption();
-                $searchindex = $dbw->tableName( 'searchindex' );
+       /** @todo document */
+    function updateTitle($id,$title) {
+            $dbw=& wfGetDB(DB_MASTER);
+            $lowpri=$dbw->lowPriorityOption();
+            $searchindex = $dbw->tableName( 'searchindex' );
 
-                $sql = "UPDATE $lowpri $searchindex SET si_title='" .
-                          $db->strencode( $title ) .
-                          "' WHERE si_page={$id}";
-
-                $dbw->query( $sql, "SearchMySQL4::updateTitle" );
-        }
+            $sql = "UPDATE $lowpri $searchindex SET si_title='" .
+                      $dbw->strencode( $title ) .
+                      "' WHERE si_page={$id}";
 
+            $dbw->query( $sql, "SearchMySQL4::updateTitle" );
+    }
 }
-
-?>
+?>
\ No newline at end of file