$lc = $this->legalSearchChars();
return trim( preg_replace( "/[^{$lc}]/", " ", $text ) );
}
+
/**
* Load up the appropriate search engine class for the currently
* active database backend, and return a configured instance.
$result->initFromTitle( $title );
return $result;
}
+
/**
* Return a new SearchResult and initializes it with a row.
*
return false;
}
}
+
/**
* A SearchResultSet wrapper for SearchEngine::getNearMatch
*/
class SearchNearMatchResultSet extends SearchResultSet {
private $fetched = false;
+
/**
* @param $match mixed Title if matched, else null
*/
public function __construct( $match ) {
$this->result = $match;
}
+
public function hasResult() {
return (bool)$this->result;
}
+
public function numRows() {
return $this->hasResults() ? 1 : 0;
}
+
public function next() {
if ( $this->fetched || !$this->result ) {
return false;