Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/213595

Change subject: Remove dead code
......................................................................

Remove dead code

Change-Id: Ie7ef09b4b6846e6ca69180d124eef9a5ff8dad1c
---
M lib/includes/store/sql/TermSqlIndex.php
M repo/includes/store/sql/TermSearchKeyBuilder.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
3 files changed, 10 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/95/213595/1

diff --git a/lib/includes/store/sql/TermSqlIndex.php 
b/lib/includes/store/sql/TermSqlIndex.php
index 8ca553f..78f9c4b 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -332,7 +332,7 @@
                        'term_language' => $term->getLanguage(),
                        'term_type' => $term->getType(),
                        'term_text' => $term->getText(),
-                       'term_search_key' => $this->getSearchKey( 
$term->getText(), $term->getLanguage() )
+                       'term_search_key' => $this->getSearchKey( 
$term->getText() )
                );
 
                return $fields;
@@ -724,7 +724,7 @@
 
                        if ( !$options['caseSensitive'] ) {
                                $textField = 'term_search_key';
-                               $text = $this->getSearchKey( $term->getText(), 
$term->getLanguage() );
+                               $text = $this->getSearchKey( $term->getText() );
                        }
 
                        if ( $options['prefixSearch'] ) {
@@ -892,8 +892,8 @@
 
                        $matchConditions = array(
                                'L.term_language' => $lang,
-                               'L.term_search_key' => $this->getSearchKey( 
$label, $lang ),
-                               'D.term_search_key' => $this->getSearchKey( 
$description, $lang )
+                               'L.term_search_key' => $this->getSearchKey( 
$label ),
+                               'D.term_search_key' => $this->getSearchKey( 
$description )
                        );
 
                        $termConditions[] = $dbr->makeList( $matchConditions, 
LIST_AND );
@@ -953,12 +953,10 @@
         * @since 0.4
         *
         * @param string $text
-        * @param string $lang language code of the text's language, may be used
-        *                     for specialized normalization.
         *
         * @return string
         */
-       public function getSearchKey( $text, $lang = 'en' ) {
+       public function getSearchKey( $text ) {
                if ( $text === null ) {
                        return null;
                }
diff --git a/repo/includes/store/sql/TermSearchKeyBuilder.php 
b/repo/includes/store/sql/TermSearchKeyBuilder.php
index 69d28a2..1f74943 100644
--- a/repo/includes/store/sql/TermSearchKeyBuilder.php
+++ b/repo/includes/store/sql/TermSearchKeyBuilder.php
@@ -156,7 +156,7 @@
                        $cError = 0;
 
                        foreach ( $terms as $row ) {
-                               $key = $this->updateSearchKey( $dbw, 
$row->term_row_id, $row->term_text, $row->term_language );
+                               $key = $this->updateSearchKey( $dbw, 
$row->term_row_id, $row->term_text );
 
                                if ( $key === false ) {
                                        $this->report( "Unable to calculate 
search key for " . $row->term_text );
@@ -193,12 +193,11 @@
         * @param \DatabaseBase $dbw the database connection to use
         * @param int $rowId the row to update
         * @param string $text the term's text
-        * @param string $lang the term's language
         *
         * @return string|bool the search key, or false if no search key could 
be calculated.
         */
-       protected function updateSearchKey( \DatabaseBase $dbw, $rowId, $text, 
$lang ) {
-               $key = $this->table->getSearchKey( $text, $lang );
+       protected function updateSearchKey( \DatabaseBase $dbw, $rowId, $text ) 
{
+               $key = $this->table->getSearchKey( $text );
 
                if ( $key === '' ) {
                        wfDebugLog( __CLASS__, __FUNCTION__ . ": failed to 
normalized term: $text" );
diff --git a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php 
b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
index 81c767d..f0f1aad 100644
--- a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
+++ b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
@@ -295,37 +295,31 @@
                return array(
                        array( // #0
                                'foo', // raw
-                               'en',  // lang
                                'foo', // normalized
                        ),
 
                        array( // #1
                                '  foo  ', // raw
-                               'en',  // lang
                                'foo', // normalized
                        ),
 
                        array( // #2: lower case of non-ascii character
                                'ÄpFEl', // raw
-                               'de',    // lang
                                'äpfel', // normalized
                        ),
 
                        array( // #3: lower case of decomposed character
                                "A\xCC\x88pfel", // raw
-                               'de',    // lang
                                'äpfel', // normalized
                        ),
 
                        array( // #4: lower case of cyrillic character
                                'Берлин', // raw
-                               'ru',     // lang
                                'берлин', // normalized
                        ),
 
                        array( // #5: lower case of greek character
                                'Τάχιστη', // raw
-                               'he',      // lang
                                'τάχιστη', // normalized
                        ),
 
@@ -334,7 +328,6 @@
                                // RTLM: U+200F \xE2\x80\x8F
                                // PSEP: U+2029 \xE2\x80\xA9
                                
"\xE2\x80\x8F\xE2\x80\x8Cfoo\xE2\x80\x8Cbar\xE2\x80\xA9", // raw
-                               'en',      // lang
                                "foo bar", // normalized
                        ),
                );
@@ -343,10 +336,10 @@
        /**
         * @dataProvider provideGetSearchKey
         */
-       public function testGetSearchKey( $raw, $lang, $normalized ) {
+       public function testGetSearchKey( $raw, $normalized ) {
                $index = $this->getTermIndex();
 
-               $key = $index->getSearchKey( $raw, $lang );
+               $key = $index->getSearchKey( $raw );
                $this->assertEquals( $normalized, $key );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7ef09b4b6846e6ca69180d124eef9a5ff8dad1c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>

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

Reply via email to