http://www.mediawiki.org/wiki/Special:Code/MediaWiki/58251
Revision: 58251 Author: maxsem Date: 2009-10-28 10:55:40 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Kind of works... Still lots of MySQLisms to clean up Modified Paths: -------------- branches/sqlite/includes/db/DatabaseSqlite.php branches/sqlite/includes/search/SearchSqlite.php branches/sqlite/maintenance/updaters.inc Modified: branches/sqlite/includes/db/DatabaseSqlite.php =================================================================== --- branches/sqlite/includes/db/DatabaseSqlite.php 2009-10-28 10:29:22 UTC (rev 58250) +++ branches/sqlite/includes/db/DatabaseSqlite.php 2009-10-28 10:55:40 UTC (rev 58251) @@ -474,7 +474,7 @@ } public function getSearchEngine() { - return "SearchEngineSqlite"; + return "SearchSqlite"; } /** Modified: branches/sqlite/includes/search/SearchSqlite.php =================================================================== --- branches/sqlite/includes/search/SearchSqlite.php 2009-10-28 10:29:22 UTC (rev 58250) +++ branches/sqlite/includes/search/SearchSqlite.php 2009-10-28 10:55:40 UTC (rev 58251) @@ -112,7 +112,7 @@ $searchon = $this->db->strencode( $searchon ); $field = $this->getIndexField( $fulltext ); - return " MATCH($field) AGAINST('$searchon' IN BOOLEAN MODE) "; + return " $field MATCH '$searchon' "; } function regexTerm( $string, $wildcard ) { @@ -247,9 +247,6 @@ /** * Get the base part of the search query. - * The actual match syntax will depend on the server - * version; MySQL 3 and MySQL 4 have different capabilities - * in their fulltext search indexes. * * @param $filteredTerm String * @param $fulltext Boolean @@ -259,7 +256,7 @@ $match = $this->parseQuery( $filteredTerm, $fulltext ); $page = $this->db->tableName( 'page' ); $searchindex = $this->db->tableName( 'searchindex' ); - return 'SELECT $searchindex.rowid, page_namespace, page_title ' . + return "SELECT $searchindex.rowid, page_namespace, page_title " . "FROM $page,$searchindex " . "WHERE page_id=$searchindex.rowid AND $match"; } Modified: branches/sqlite/maintenance/updaters.inc =================================================================== --- branches/sqlite/maintenance/updaters.inc 2009-10-28 10:29:22 UTC (rev 58250) +++ branches/sqlite/maintenance/updaters.inc 2009-10-28 10:55:40 UTC (rev 58251) @@ -189,6 +189,9 @@ array( 'add_index', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ), array( 'add_index', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ), array( 'add_field', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ), + + // version-independent searchindex setup, added in 1.16 + array( 'sqlite_setup_searchindex' ), ), ); @@ -1281,6 +1284,23 @@ wfOut( "done\n" ); } +function sqlite_setup_searchindex() { + global $wgDatabase; + $module = $wgDatabase->fulltextSearchModule(); + $fts3tTable = update_row_exists( 'fts3' ); + if ( $fts3tTable && !$module ) { + wfOut( '...PHP is missing FTS3 support, downgrading tables...' ); + $wgDatabase->sourceFile( archive( 'patch-searchindex-no-fts.sql' ) ); + wfOut( "done\n" ); + } elseif ( !$fts3tTable && $module == 'FTS3' ) { + wfOut( '...adding FTS3 search capabilities...' ); + $wgDatabase->sourceFile( archive( 'patch-fts3-searchindex.sql' ) ); + wfOut( "done\n" ); + } else { + wfOut( "...fulltext search table appears to be in order.\n" ); + } +} + function do_unique_pl_tl_il() { global $wgDatabase; $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs