https://bugzilla.wikimedia.org/show_bug.cgi?id=46611

       Web browser: ---
            Bug ID: 46611
           Summary: Change settings to not override those set in
                    LocalSettings.php or other custom setting sources.
                    Fixed an issue with userHighlightPrefs() not matching
                    the current definition in the User class.  Changed the
                    default of $wgEnableSphinxPrefixSearch to true so
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: SphinxSearch
          Assignee: sve...@deveblog.com
          Reporter: was...@gmail.com
                CC: wikibugs-l@lists.wikimedia.org
    Classification: Unclassified
   Mobile Platform: ---

Created attachment 11998
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=11998&action=edit
Modified files ready to go.

Various fixes to improve this extension.  It has not been updated since
2011-09-11 and is current incompatible with Mediawiki 1.19.x and 1.20.x.  It
also improves the settings interface to allow it to be configured without
modifying the extension.

diff --git a/SphinxMWSearch.php b/SphinxMWSearch.php
index edb08b8..e3e7547 100644
--- a/SphinxMWSearch.php
+++ b/SphinxMWSearch.php
@@ -179,14 +179,13 @@ class SphinxMWSearch extends SearchEngine {
        }

        /**
-    * Find snippet highlight settings for a given user
+  * Find snippet highlight settings for all users
         *
-    * @param $user User
         * @return Array contextlines, contextchars
         */
-   public static function userHighlightPrefs( &$user ) {
-           $contextlines = $user->getOption( 'contextlines', 2 );
-           $contextchars = $user->getOption( 'contextchars', 75 );
+ public static function userHighlightPrefs() {
+         $contextlines = 2; // Hardcode this. Old defaults sucked. :)
+         $contextchars = 75; // same as above.... :P
                return array( $contextlines, $contextchars );
        }

diff --git a/SphinxSearch.i18n.php b/SphinxSearch.i18n.php
index fce1668..45ebb27 100644
--- a/SphinxSearch.i18n.php
+++ b/SphinxSearch.i18n.php
@@ -21,8 +21,6 @@ $messages['en'] = array(
 $messages['qqq'] = array(
        'sphinxsearch-desc' => '{{desc|name=Sphinx
Search|url=http://www.mediawiki.org/wiki/Extension:SphinxSearch}}',
        'sphinxPowered' => '$1 is replaced with a text "Sphinx" inside a
link.',
-   'sphinxSearchFailed' => 'Unused at this time. Parameters:
-* $1 - ...',
 );

 /** Afrikaans (Afrikaans)
diff --git a/SphinxSearch.php b/SphinxSearch.php
index 2632250..d746461 100644
--- a/SphinxSearch.php
+++ b/SphinxSearch.php
@@ -46,16 +46,24 @@ if ( !class_exists( 'SphinxClient' ) ) {
 }

 # Host and port on which searchd deamon is running
-$wgSphinxSearch_host = '127.0.0.1';
-$wgSphinxSearch_port = 9312;
+if (!isset($wgSphinxSearch_host)) {
+ $wgSphinxSearch_host = '127.0.0.1';
+}
+if (!isset($wgSphinxSearch_port) and !is_numeric($wgSphinxSearch_port)) {
+ $wgSphinxSearch_port = 9312;
+}

 # Main sphinx.conf index to search
-$wgSphinxSearch_index = "wiki_main";
+if (!$wgSphinxSearch_index) {
+ $wgSphinxSearch_index = "wiki_main";
+}

 # By default, we search all available indexes
 # You can also specify them explicitly, e.g
 # $wgSphinxSearch_index_list = "wiki_main,wiki_incremental";
-$wgSphinxSearch_index_list = "*";
+if (!$wgSphinxSearch_index_list) {
+ $wgSphinxSearch_index_list = "*";
+}

 # If you have multiple index files, you can specify their weights like this
 # See http://www.sphinxsearch.com/docs/current.html#api-func-setindexweights
@@ -101,7 +109,7 @@ $wgSphinxSearchPersonalDictionary = '';

 # If true, use SphinxMWSearch for prefix search instead of the core default.
 # This influences results from ApiOpenSearch.
-$wgEnableSphinxPrefixSearch = false;
+$wgEnableSphinxPrefixSearch = true;

 function efSphinxSearchPrefixSetup() {
        global $wgHooks, $wgEnableSphinxPrefixSearch;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to