aboutsummaryrefslogtreecommitdiffstats
path: root/includes/search/SearchPostgres.php
diff options
context:
space:
mode:
authorumherirrender <umherirrender_de.wp@web.de>2013-02-03 19:30:03 +0100
committerGerrit Code Review <gerrit@wikimedia.org>2013-02-04 19:54:07 +0000
commitbe90ce07b38e5891cee4afe447d5a5f924bb46fe (patch)
tree5c058edfa7efb2912e5e13dbcbe5f83a4850206d /includes/search/SearchPostgres.php
parent0cfa07f623d0623e83e3f162ee4e4a37fc1d7a53 (diff)
downloadmediawikicore-be90ce07b38e5891cee4afe447d5a5f924bb46fe.tar.gz
mediawikicore-be90ce07b38e5891cee4afe447d5a5f924bb46fe.zip
fix some spacing
Change-Id: I93f0a87ba7129bc336083e7289247d3150feb606
Diffstat (limited to 'includes/search/SearchPostgres.php')
-rw-r--r--includes/search/SearchPostgres.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php
index 9c89c3dff4db..727cc1660450 100644
--- a/includes/search/SearchPostgres.php
+++ b/includes/search/SearchPostgres.php
@@ -66,8 +66,8 @@ class SearchPostgres extends SearchEngine {
$q = $this->searchQuery( $term, 'textvector', 'old_text' );
$olderror = error_reporting(E_ERROR);
$resultSet = $this->db->resultObject( $this->db->query( $q, 'SearchPostgres', true ) );
- error_reporting($olderror);
- if (!$resultSet) {
+ error_reporting( $olderror );
+ if ( !$resultSet ) {
return new SearchResultTooMany();
}
return new PostgresSearchResultSet( $resultSet, $this->searchTerms );
@@ -99,16 +99,16 @@ class SearchPostgres extends SearchEngine {
$m = array();
if( preg_match_all('/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) {
foreach( $m as $terms ) {
- if (strlen($terms[1])) {
+ if ( strlen( $terms[1] ) ) {
$searchstring .= ' & !';
}
- if (strtolower($terms[2]) === 'and') {
+ if ( strtolower( $terms[2] ) === 'and' ) {
$searchstring .= ' & ';
}
- elseif (strtolower($terms[2]) === 'or' or $terms[2] === '|') {
+ elseif ( strtolower( $terms[2] ) === 'or' or $terms[2] === '|' ) {
$searchstring .= ' | ';
}
- elseif (strtolower($terms[2]) === 'not') {
+ elseif ( strtolower( $terms[2] ) === 'not' ) {
$searchstring .= ' & !';
}
else {
@@ -133,7 +133,7 @@ class SearchPostgres extends SearchEngine {
$searchstring = preg_replace('/^[\'"](.*)[\'"]$/', "$1", $searchstring);
## Quote the whole thing
- $searchstring = $this->db->addQuotes($searchstring);
+ $searchstring = $this->db->addQuotes( $searchstring );
wfDebug( "parseQuery returned: $searchstring \n" );
@@ -154,15 +154,15 @@ class SearchPostgres extends SearchEngine {
## We need a separate query here so gin does not complain about empty searches
$SQL = "SELECT to_tsquery($searchstring)";
- $res = $this->db->query($SQL);
- if (!$res) {
+ $res = $this->db->query( $SQL );
+ if ( !$res ) {
## TODO: Better output (example to catch: one 'two)
- die ("Sorry, that was not a valid search string. Please go back and try again");
+ die( "Sorry, that was not a valid search string. Please go back and try again" );
}
$top = $res->fetchRow();
$top = $top[0];
- if ($top === "") { ## e.g. if only stopwords are used XXX return something better
+ if ( $top === "" ) { ## e.g. if only stopwords are used XXX return something better
$query = "SELECT page_id, page_namespace, page_title, 0 AS score ".
"FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
"AND r.rev_text_id = c.old_id AND 1=0";
@@ -182,7 +182,7 @@ class SearchPostgres extends SearchEngine {
}
## Redirects
- if (! $this->showRedirects)
+ if ( !$this->showRedirects )
$query .= ' AND page_is_redirect = 0';
## Namespaces - defaults to 0
@@ -226,7 +226,7 @@ class SearchPostgres extends SearchEngine {
*/
class PostgresSearchResult extends SearchResult {
function __construct( $row ) {
- parent::__construct($row);
+ parent::__construct( $row );
$this->score = $row->score;
}
function getScore() {