Index: trunk/phase3/includes/search/SearchPostgres.php |
— | — | @@ -141,13 +141,11 @@ |
142 | 142 | function searchQuery( $term, $fulltext, $colname ) { |
143 | 143 | $postgresVersion = $this->db->getServerVersion(); |
144 | 144 | |
145 | | - $prefix = $postgresVersion < 8.3 ? "'default'," : ''; |
146 | | - |
147 | 145 | # Get the SQL fragment for the given term |
148 | 146 | $searchstring = $this->parseQuery( $term ); |
149 | 147 | |
150 | 148 | ## We need a separate query here so gin does not complain about empty searches |
151 | | - $SQL = "SELECT to_tsquery($prefix $searchstring)"; |
| 149 | + $SQL = "SELECT to_tsquery($searchstring)"; |
152 | 150 | $res = $this->db->doQuery($SQL); |
153 | 151 | if (!$res) { |
154 | 152 | ## TODO: Better output (example to catch: one 'two) |
— | — | @@ -168,12 +166,10 @@ |
169 | 167 | } |
170 | 168 | } |
171 | 169 | |
172 | | - $rankscore = $postgresVersion > 8.2 ? 5 : 1; |
173 | | - $rank = $postgresVersion < 8.3 ? 'rank' : 'ts_rank'; |
174 | 170 | $query = "SELECT page_id, page_namespace, page_title, ". |
175 | | - "$rank($fulltext, to_tsquery($prefix $searchstring), $rankscore) AS score ". |
| 171 | + "ts_rank($fulltext, to_tsquery($searchstring), 5) AS score ". |
176 | 172 | "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . |
177 | | - "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($prefix $searchstring)"; |
| 173 | + "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($searchstring)"; |
178 | 174 | } |
179 | 175 | |
180 | 176 | ## Redirects |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -193,13 +193,12 @@ |
194 | 194 | $this->doQuery( "SET client_encoding='UTF8'" ); |
195 | 195 | |
196 | 196 | global $wgDBmwschema, $wgDBts2schema; |
197 | | - if ( isset( $wgDBmwschema ) && isset( $wgDBts2schema ) |
| 197 | + if ( isset( $wgDBmwschema ) |
198 | 198 | && $wgDBmwschema !== 'mediawiki' |
199 | 199 | && preg_match( '/^\w+$/', $wgDBmwschema ) |
200 | | - && preg_match( '/^\w+$/', $wgDBts2schema ) |
201 | 200 | ) { |
202 | 201 | $safeschema = $this->addIdentifierQuotes( $wgDBmwschema ); |
203 | | - $this->doQuery( "SET search_path = $safeschema, $wgDBts2schema, public" ); |
| 202 | + $this->doQuery( "SET search_path = $safeschema, public" ); |
204 | 203 | } |
205 | 204 | |
206 | 205 | return $this->mConn; |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -195,7 +195,6 @@ |
196 | 196 | 'config-mysql-old' => 'MySQL $1 or later is required, you have $2.', |
197 | 197 | 'config-db-port' => 'Database port:', |
198 | 198 | 'config-db-schema' => 'Schema for MediaWiki', |
199 | | - 'config-db-ts2-schema' => 'Schema for tsearch2', |
200 | 199 | 'config-db-schema-help' => 'The above schemas are usually correct. |
201 | 200 | Only change them if you know you need to.', |
202 | 201 | 'config-sqlite-dir' => 'SQLite data directory:', |
— | — | @@ -243,8 +242,6 @@ |
244 | 243 | Check the host, username and password below and try again.', |
245 | 244 | 'config-invalid-schema' => 'Invalid schema for MediaWiki "$1". |
246 | 245 | Use only ASCII letters (a-z, A-Z), numbers (0-9) and underscores (_).', |
247 | | - 'config-invalid-ts2schema' => 'Invalid schema for TSearch2 "$1". |
248 | | -Use only ASCII letters (a-z, A-Z), numbers (0-9) and underscores (_).', |
249 | 246 | 'config-postgres-old' => 'PostgreSQL $1 or later is required, you have $2.', |
250 | 247 | 'config-sqlite-name-help' => 'Choose a name that identifies your wiki. |
251 | 248 | Do not use spaces or hyphens. |
— | — | @@ -450,9 +447,6 @@ |
451 | 448 | 'config-install-pg-commit' => 'Committing changes', |
452 | 449 | 'config-install-pg-plpgsql' => 'Checking for language PL/pgSQL', |
453 | 450 | 'config-pg-no-plpgsql' => 'You need to install the language PL/pgSQL in the database $1', |
454 | | - 'config-install-pg-ts2' => 'Checking for tsearch2', |
455 | | - 'config-install-pg-ts2-failed' => "'''FAILED''' tsearch2 must be installed in the database $1. |
456 | | -Please read [$2 these instructions] or ask on #postgresql on irc.freenode.net", |
457 | 451 | 'config-install-user' => 'Creating database user', |
458 | 452 | 'config-install-user-failed' => 'Granting permission to user "$1" failed: $2', |
459 | 453 | 'config-install-tables' => 'Creating tables', |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -24,8 +24,7 @@ |
25 | 25 | 'wgDBts2schema', |
26 | 26 | ); |
27 | 27 | |
28 | | - var $minimumVersion = '8.1'; |
29 | | - private $ts2MaxVersion = '8.3'; // Doing ts2 is not necessary in PG > 8.3 |
| 28 | + var $minimumVersion = '8.3'; |
30 | 29 | |
31 | 30 | function getName() { |
32 | 31 | return 'postgres'; |
— | — | @@ -43,7 +42,6 @@ |
44 | 43 | Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) . |
45 | 44 | $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) . |
46 | 45 | $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) . |
47 | | - $this->getTextBox( 'wgDBts2schema', 'config-db-ts2-schema' ) . |
48 | 46 | Html::closeElement( 'fieldset' ) . |
49 | 47 | $this->getInstallUserBox(); |
50 | 48 | } |
— | — | @@ -51,7 +49,7 @@ |
52 | 50 | function submitConnectForm() { |
53 | 51 | // Get variables from the request |
54 | 52 | $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBport', |
55 | | - 'wgDBname', 'wgDBmwschema', 'wgDBts2schema' ) ); |
| 53 | + 'wgDBname', 'wgDBmwschema' ) ); |
56 | 54 | |
57 | 55 | // Validate them |
58 | 56 | $status = Status::newGood(); |
— | — | @@ -63,9 +61,6 @@ |
64 | 62 | if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) { |
65 | 63 | $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] ); |
66 | 64 | } |
67 | | - if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBts2schema'] ) ) { |
68 | | - $status->fatal( 'config-invalid-ts2schema', $newValues['wgDBts2schema'] ); |
69 | | - } |
70 | 65 | |
71 | 66 | // Submit user box |
72 | 67 | if ( $status->isOK() ) { |
— | — | @@ -196,17 +191,12 @@ |
197 | 192 | 'name' => 'user', |
198 | 193 | 'callback' => array( $this, 'setupUser' ), |
199 | 194 | ); |
200 | | - $ts2CB = array( |
201 | | - 'name' => 'pg-ts2', |
202 | | - 'callback' => array( $this, 'setupTs2' ), |
203 | | - ); |
204 | 195 | $plpgCB = array( |
205 | 196 | 'name' => 'pg-plpgsql', |
206 | 197 | 'callback' => array( $this, 'setupPLpgSQL' ), |
207 | 198 | ); |
208 | 199 | $this->parent->addInstallStep( $commitCB, 'interwiki' ); |
209 | 200 | $this->parent->addInstallStep( $userCB ); |
210 | | - $this->parent->addInstallStep( $ts2CB, 'database' ); |
211 | 201 | $this->parent->addInstallStep( $plpgCB, 'database' ); |
212 | 202 | } |
213 | 203 | |
— | — | @@ -266,36 +256,6 @@ |
267 | 257 | return $status; |
268 | 258 | } |
269 | 259 | |
270 | | - /** |
271 | | - * Ts2 isn't needed in newer versions of Postgres, so wrap it in a nice big |
272 | | - * version check and skip it if we're new. Maybe we can bump $minimumVersion |
273 | | - * one day and render this obsolete :) |
274 | | - * |
275 | | - * @return Status |
276 | | - */ |
277 | | - function setupTs2() { |
278 | | - $status = $this->getConnection(); |
279 | | - if ( !$status->isOK() ) { |
280 | | - return $status; |
281 | | - } |
282 | | - |
283 | | - if( version_compare( $this->db->getServerVersion(), $this->ts2MaxVersion, '<' ) ) { |
284 | | - if ( !$this->db->tableExists( 'pg_ts_cfg', $this->getVar( 'wgDBts2schema' ) ) ) { |
285 | | - return Status::newFatal( |
286 | | - 'config-install-pg-ts2-failed', |
287 | | - $this->getVar( 'wgDBname' ), |
288 | | - 'http://www.devx.com/opensource/Article/21674/0/page/2' |
289 | | - ); |
290 | | - } |
291 | | - $safeuser = $this->db->addQuotes( $this->getVar( 'wgDBuser' ) ); |
292 | | - foreach ( array( 'cfg', 'cfgmap', 'dict', 'parser' ) as $table ) { |
293 | | - $sql = "GRANT SELECT ON pg_ts_$table TO $safeuser"; |
294 | | - $this->db->query( $sql, __METHOD__ ); |
295 | | - } |
296 | | - } |
297 | | - return Status::newGood(); |
298 | | - } |
299 | | - |
300 | 260 | function commitChanges() { |
301 | 261 | $this->db->query( 'COMMIT' ); |
302 | 262 | return Status::newGood(); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1180,8 +1180,6 @@ |
1181 | 1181 | |
1182 | 1182 | /** Mediawiki schema */ |
1183 | 1183 | $wgDBmwschema = 'mediawiki'; |
1184 | | -/** Tsearch2 schema */ |
1185 | | -$wgDBts2schema = 'public'; |
1186 | 1184 | |
1187 | 1185 | /** To override default SQLite data directory ($docroot/../data) */ |
1188 | 1186 | $wgSQLiteDataDir = ''; |