diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php b/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php index ffa34a81..2de480a8 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php +++ b/vendor/ruflin/elastica/lib/Elastica/Query/FuzzyLikeThis.php @@ -1,79 +1,77 @@ <?php - namespace Elastica\Query; /** - * Fuzzy Like This query + * Fuzzy Like This query. * - * @category Xodoa - * @package Elastica * @author Raul Martinez, Jr <juneym@gmail.com> - * @link http://www.elasticsearch.org/guide/reference/query-dsl/flt-query.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-flt-query.html */ class FuzzyLikeThis extends AbstractQuery { /** - * Field names + * Field names. * * @var array Field names */ protected $_fields = array(); /** - * Like text + * Like text. * * @var string Like text */ - protected $_likeText = ''; + protected $_likeText = ''; /** - * Ignore term frequency + * Ignore term frequency. * - * @var boolean ignore term frequency + * @var bool ignore term frequency */ protected $_ignoreTF = false; /** - * Max query terms value + * Max query terms value. * * @var int Max query terms value */ protected $_maxQueryTerms = 25; /** - * minimum similarity + * minimum similarity. * * @var int minimum similarity */ protected $_minSimilarity = 0.5; /** - * Prefix Length + * Prefix Length. * * @var int Prefix Length */ protected $_prefixLength = 0; /** - * Boost + * Boost. * * @var float Boost */ protected $_boost = 1.0; /** - * Analyzer + * Analyzer. * * @var sting Analyzer */ protected $_analyzer; - /** - * Adds field to flt query + * Adds field to flt query. + * + * @param array $fields Field names * - * @param array $fields Field names - * @return \Elastica\Query\FuzzyLikeThis Current object + * @return $this */ public function addFields(array $fields) { @@ -83,10 +81,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the "like_text" value + * Set the "like_text" value. * - * @param string $text - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param string $text + * + * @return $this */ public function setLikeText($text) { @@ -97,10 +96,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the "ignore_tf" value (ignore term frequency) + * Set the "ignore_tf" value (ignore term frequency). + * + * @param bool $ignoreTF * - * @param bool $ignoreTF - * @return \Elastica\Query\FuzzyLikeThis Current object + * @return $this */ public function setIgnoreTF($ignoreTF) { @@ -110,10 +110,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set the minimum similarity + * Set the minimum similarity. * - * @param int $value - * @return \Elastica\Query\FuzzyLikeThis This current object + * @param int $value + * + * @return $this */ public function setMinSimilarity($value) { @@ -124,10 +125,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set boost + * Set boost. + * + * @param float $value Boost value * - * @param float $value Boost value - * @return \Elastica\Query\FuzzyLikeThis Query object + * @return $this */ public function setBoost($value) { @@ -137,10 +139,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set Prefix Length + * Set Prefix Length. * - * @param int $value Prefix length - * @return \Elastica\Query\FuzzyLikeThis + * @param int $value Prefix length + * + * @return $this */ public function setPrefixLength($value) { @@ -150,10 +153,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set max_query_terms + * Set max_query_terms. + * + * @param int $value Max query terms value * - * @param int $value Max query terms value - * @return \Elastica\Query\FuzzyLikeThis + * @return $this */ public function setMaxQueryTerms($value) { @@ -163,10 +167,11 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Set analyzer + * Set analyzer. * - * @param string $text Analyzer text - * @return \Elastica\Query\FuzzyLikeThis + * @param string $text Analyzer text + * + * @return $this */ public function setAnalyzer($text) { @@ -177,9 +182,10 @@ class FuzzyLikeThis extends AbstractQuery } /** - * Converts fuzzy like this query to array + * Converts fuzzy like this query to array. * * @return array Query array + * * @see \Elastica\Query\AbstractQuery::toArray() */ public function toArray() @@ -192,18 +198,14 @@ class FuzzyLikeThis extends AbstractQuery $args['boost'] = $this->_boost; } - if (!empty($this->_likeText)) { - $args['like_text'] = $this->_likeText; - } - if (!empty($this->_analyzer)) { $args['analyzer'] = $this->_analyzer; } - $args['min_similarity'] = ($this->_minSimilarity > 0) ? $this->_minSimilarity : 0; - $args['prefix_length'] = $this->_prefixLength; + $args['like_text'] = $this->_likeText; + $args['prefix_length'] = $this->_prefixLength; $args['ignore_tf'] = $this->_ignoreTF; $args['max_query_terms'] = $this->_maxQueryTerms; |