DCausse has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349192 )

Change subject: Fix deprecation warning raised by elasticsearch5
......................................................................

Fix deprecation warning raised by elasticsearch5

min_similarity has been deprecated, use the proper field name and set
it to sane default.

Bug: T163345
Change-Id: Ie9a27f83d89f389c2c144165e7346a2bcfed432c
---
M ttmserver/ElasticSearchTTMServer.php
M ttmserver/FuzzyLikeThis.php
2 files changed, 7 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/92/349192/1

diff --git a/ttmserver/ElasticSearchTTMServer.php 
b/ttmserver/ElasticSearchTTMServer.php
index 4b1c686..75bca84 100644
--- a/ttmserver/ElasticSearchTTMServer.php
+++ b/ttmserver/ElasticSearchTTMServer.php
@@ -97,7 +97,6 @@
                $connection->setTimeout( 10 );
 
                $fuzzyQuery = new FuzzyLikeThis();
-               $fuzzyQuery->setMinSimilarity( 2 );
                $fuzzyQuery->setLikeText( $text );
                $fuzzyQuery->addFields( [ 'content' ] );
 
diff --git a/ttmserver/FuzzyLikeThis.php b/ttmserver/FuzzyLikeThis.php
index 53bbb4b..bf13b7c 100644
--- a/ttmserver/FuzzyLikeThis.php
+++ b/ttmserver/FuzzyLikeThis.php
@@ -76,11 +76,11 @@
        protected $_maxQueryTerms = 25;
 
        /**
-        * minimum similarity.
+        * fuzziness.
         *
-        * @var int minimum similarity
+        * @var int fuzziness
         */
-       protected $_minSimilarity = 0.5;
+       protected $_fuzziness = 2;
 
        /**
         * Prefix Length.
@@ -144,9 +144,9 @@
         *
         * @return $this
         */
-       public function setMinSimilarity( $value ) {
-               $value = (float) $value;
-               $this->_minSimilarity = $value;
+       public function setFuzziness( $value ) {
+               $value = (int) $value;
+               $this->_fuzziness = $value;
 
                return $this;
        }
@@ -207,7 +207,7 @@
                        $args['analyzer'] = $this->_analyzer;
                }
 
-               $args['min_similarity'] = ( $this->_minSimilarity > 0 ) ? 
$this->_minSimilarity : 0;
+               $args['fuzziness'] = ( $this->_fuzziness > 0 ) ? 
$this->_fuzziness : 0;
 
                $args['like_text'] = $this->_likeText;
                $args['prefix_length'] = $this->_prefixLength;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9a27f83d89f389c2c144165e7346a2bcfed432c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to