wfProfileIn( __METHOD__ );
$page = WikiPage::newFromId( $this->id, WikiPage::READ_LATEST );
- $indexTitle = $this->indexTitle();
foreach ( SearchEngine::getSearchTypes() as $type ) {
$search = SearchEngine::create( $type );
+ $indexTitle = $this->indexTitle( $search );
if ( !$search->supports( 'search-update' ) ) {
continue;
}
*
* @return string A stripped-down title string ready for the search index
*/
- private function indexTitle() {
+ private function indexTitle( SearchEngine $search ) {
global $wgContLang;
$ns = $this->title->getNamespace();
$title = $this->title->getText();
- $lc = SearchEngine::legalSearchChars() . '&#;';
+ $lc = $search->legalSearchChars() . '&#;';
$t = $wgContLang->normalizeForSearch( $title );
$t = preg_replace( "/[^{$lc}]+/", ' ', $t );
$t = $wgContLang->lc( $t );
$this->db = wfGetDB( DB_SLAVE );
}
}
+
+ /**
+ * Return a 'cleaned up' search string
+ *
+ * @param string $text
+ * @return string
+ */
+ protected function filter( $text ) {
+ $lc = $this->legalSearchChars();
+ return trim( preg_replace( "/[^{$lc}]/", " ", $text ) );
+ }
}
return $formatted;
}
- /**
- * Return a 'cleaned up' search string
- *
- * @param string $text
- * @return string
- */
- function filter( $text ) {
- $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.