r96467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96466‎ | r96467 | r96468 >
Date:18:53, 7 September 2011
Author:svemir
Status:deferred
Tags:
Comment:
clarify suggestion modes, bail out if enchant not installed
Modified paths:
  • /trunk/extensions/SphinxSearch/SphinxMWSearch.php (modified) (history)
  • /trunk/extensions/SphinxSearch/SphinxSearch.php (modified) (history)
  • /trunk/extensions/SphinxSearch/SphinxSearch_setup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SphinxSearch/SphinxSearch.php
@@ -74,8 +74,10 @@
7575 # Set to true to use MW's default search snippets and highlighting
7676 $wgSphinxSearchMWHighlighter = false;
7777
78 -# Should the suggestion (Did you mean?) mode be enabled?
79 -# Possible values: enchant, soundex, aspell
 78+# Should the suggestion (Did you mean?) mode be enabled? Possible values:
 79+# enchant - see http://www.mediawiki.org/wiki/Extension_talk:SphinxSearch#Search_suggestions
 80+# soundex - uses MySQL soundex() function to recommend existing titles
 81+# aspell - uses aspell command-line utility to look for similar spellings
8082 $wgSphinxSuggestMode = '';
8183
8284 # Path to aspell, adjust value if not in the system path
Index: trunk/extensions/SphinxSearch/SphinxSearch_setup.php
@@ -17,7 +17,7 @@
1818 parent::__construct();
1919
2020 $this->mDescription = "Sets up myspell dictionary (sphinx.dic and sphinx.aff) ";
21 - $this->mDescription .= "for for search suggestions (suggestWithEnchant method.)\n";
 21+ $this->mDescription .= "for search suggestions (suggestWithEnchant method.)\n";
2222 $this->mDescription .= "Uses Sphinx indexer to create a list ";
2323 $this->mDescription .= "of all indexed words, sorted by frequency.";
2424 }
Index: trunk/extensions/SphinxSearch/SphinxMWSearch.php
@@ -230,6 +230,9 @@
231231 * Use SphinxSearch_setup.php to create the dictionary
232232 */
233233 function suggestWithEnchant() {
 234+ if (!function_exists('enchant_broker_init')) {
 235+ return;
 236+ }
234237 $broker = enchant_broker_init();
235238 enchant_broker_set_dict_path($broker, ENCHANT_MYSPELL, dirname( __FILE__ ));
236239 if ( enchant_broker_dict_exists( $broker, 'sphinx' ) ) {

Status & tagging log