r63458 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63457‎ | r63458 | r63459 >
Date:04:19, 9 March 2010
Author:mah
Status:ok
Tags:
Comment:
follow-up r61856 — wordsegmentation should be done for all search engines, not just mysql
Modified paths:
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/search/SearchMySQL.php (modified) (history)
  • /trunk/phase3/includes/search/SearchUpdate.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguageZh_hans.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/search/SearchEngine.php
@@ -56,7 +56,10 @@
5757 * @return string
5858 */
5959 public function normalizeText( $string ) {
60 - return $string;
 60+ global $wgContLang;
 61+
 62+ // Some languages such as Chinese require word segmentation
 63+ return $wgContLang->wordSegmentation( $string );
6164 }
6265
6366 /**
Index: trunk/phase3/includes/search/SearchMySQL.php
@@ -325,8 +325,7 @@
326326
327327 wfProfileIn( __METHOD__ );
328328
329 - // Some languages such as Chinese require word segmentation
330 - $out = $wgContLang->wordSegmentation( $string );
 329+ $out = parent::normalizeText( $string );
331330
332331 // MySQL fulltext index doesn't grok utf-8, so we
333332 // need to fold cases and convert to hex
Index: trunk/phase3/includes/search/SearchUpdate.php
@@ -37,7 +37,7 @@
3838
3939 if( $this->mText === false ) {
4040 $search->updateTitle($this->mId,
41 - Title::indexTitle( $this->mNamespace, $this->mTitle ));
 41+ $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ) );
4242 wfProfileOut( $fname );
4343 return;
4444 }
@@ -97,8 +97,8 @@
9898 wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) );
9999
100100 # Perform the actual update
101 - $search->update($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle ),
102 - $text);
 101+ $search->update($this->mId, $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ),
 102+ $search->normalizeText( $text ) );
103103
104104 wfProfileOut( $fname );
105105 }
Index: trunk/phase3/languages/classes/LanguageZh_hans.php
@@ -25,6 +25,7 @@
2626 // Double-width roman characters
2727 $s = self::convertDoubleWidth( $string );
2828 $s = trim( $s );
 29+ $s = self::wordSegmentation( $s );
2930 $s = parent::normalizeForSearch( $s );
3031
3132 wfProfileOut( __METHOD__ );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61856Follow up r60742, r60743, r60764, r60766, r61214, r61390. Split stripForSearc...philip15:09, 2 February 2010

Status & tagging log