r60742 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60741‎ | r60742 | r60743 >
Date:19:44, 6 January 2010
Author:philip
Status:ok (Comments)
Tags:
Comment:
Add stripForSearch in MWSearch. So we could regularize text before indexing and term for searching. The corresponding patch for MediaWiki will commit on my next reversion.
Modified paths:
  • /trunk/extensions/MWSearch/MWSearchUpdater.php (modified) (history)
  • /trunk/extensions/MWSearch/MWSearch_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MWSearch/MWSearchUpdater.php
@@ -20,6 +20,8 @@
2121 * @static
2222 */
2323 function updatePage( $dbname, $title, $text ) {
 24+ global $wgContLang;
 25+ $text = $wgContLang->stripForSearch( $text );
2426 return MWSearchUpdater::sendRPC( 'searchupdater.updatePage',
2527 array( $dbname, $title, $text ) );
2628 }
@@ -193,4 +195,3 @@
194196 }
195197
196198
197 -
Index: trunk/extensions/MWSearch/MWSearch_body.php
@@ -9,6 +9,8 @@
1010 * @access public
1111 */
1212 function searchText( $term ) {
 13+ global $wgContLang;
 14+ $term = $wgContLang->stripForSearch( $term );
1315 return LuceneSearchSet::newFromQuery( isset($this->related)? 'related' : 'search',
1416 $term, $this->namespaces, $this->limit, $this->offset, $this->searchingEverything() );
1517 }
@@ -747,4 +749,4 @@
748750 return new LuceneResult( $group, $this->mMethod );
749751 }
750752
751 -}
 753+}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r60766follow-up r60742. adapt to the code changes made in r60764.philip04:53, 7 January 2010
r61856Follow up r60742, r60743, r60764, r60766, r61214, r61390. Split stripForSearc...philip15:09, 2 February 2010

Comments

#Comment by Tim Starling (talk | contribs)   00:29, 12 March 2010

Robert Stojnic tells me that converting full-width latin characters to normal ones should be unnecessary for Lucene, since it is already done by UnicodeDecomposer.java, both on update and on query, and so it should be unnecessary to do it here in MWSearch. And further, he tells me that MWSearchUpdater.php is unused and can be deleted, so clearly the patch there won't work.

I'm going to revert this in trunk and 1.16 pending further testing.

Status & tagging log