jenkins-bot has submitted this change and it was merged.

Change subject: Fix broken analyzer customization.
......................................................................


Fix broken analyzer customization.

Looks like my customization wasn't working even though I though I
thought it was.  This fixes it.

Change-Id: Ie35f57e817d00b75157cd92922628441b5570b74
---
M CirrusSearchAnalysisConfigBuilder.php
1 file changed, 8 insertions(+), 11 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CirrusSearchAnalysisConfigBuilder.php 
b/CirrusSearchAnalysisConfigBuilder.php
index ef295b0..4f1588b 100644
--- a/CirrusSearchAnalysisConfigBuilder.php
+++ b/CirrusSearchAnalysisConfigBuilder.php
@@ -35,9 +35,7 @@
         * @return array the analysis config
         */
        public function buildConfig() {
-               $config = $this->defaults();
-               $this->customize( $config );
-               return $config;
+               return $this->customize( $this->defaults() );
        }
 
        /**
@@ -92,32 +90,31 @@
         * Customize the default config for the language.
         */
        private function customize( $config ) {
-               $analyzers = $config[ 'analyzer' ];
-               $filters = $config[ 'filter' ];
                switch ( $this->language ) {
                // Please add languages in alphabetical order.
                case 'el':
-                       $filters[ 'lowercase' ][ 'language' ] = 'greek';
+                       $config[ 'filter' ][ 'lowercase' ][ 'language' ] = 
'greek';
                        break;
                case 'en':
                        // Replace the default english analyzer with a rebuilt 
copy with asciifolding tacked on the end
-                       $analyzers[ 'text' ] = array(
+                       $config[ 'analyzer' ][ 'text' ] = array(
                                'type' => 'custom',
                                'tokenizer' => 'standard',
                                'filter' => array( 'standard', 
'possessive_english', 'lowercase', 'stop', 'porter_stem', 'asciifolding' )
                        );
-                       $filters[ 'possessive_english' ] = array(
+                       $config[ 'filter' ][ 'possessive_english' ] = array(
                                'type' => 'stemmer',
                                'language' => 'possessive_english',
                        );
                        // Add asciifolding to the prefix queries
-                       $analyzers[ 'prefix' ][ 'filter' ][] = 'asciifolding';
-                       $analyzers[ 'prefix_query' ][ 'filter' ][] = 
'asciifolding';
+                       $config[ 'analyzer' ][ 'prefix' ][ 'filter' ][] = 
'asciifolding';
+                       $config[ 'analyzer' ][ 'prefix_query' ][ 'filter' ][] = 
'asciifolding';
                        break;
                case 'tr':
-                       $filter[ 'lowercase' ][ 'language' ] = 'turkish';
+                       $config[ 'filter' ][ 'lowercase' ][ 'language' ] = 
'turkish';
                        break;
                }
+               return $config;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/78151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie35f57e817d00b75157cd92922628441b5570b74
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <never...@wikimedia.org>
Gerrit-Reviewer: Demon <ch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to