From 1a365e77dfb8825136626202b1df462731b42060 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 16 Aug 2015 08:22:05 +0200 Subject: Update to MediaWiki 1.25.2 --- .../lib/Elastica/Suggest/AbstractSuggest.php | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 vendor/ruflin/elastica/lib/Elastica/Suggest/AbstractSuggest.php (limited to 'vendor/ruflin/elastica/lib/Elastica/Suggest/AbstractSuggest.php') diff --git a/vendor/ruflin/elastica/lib/Elastica/Suggest/AbstractSuggest.php b/vendor/ruflin/elastica/lib/Elastica/Suggest/AbstractSuggest.php new file mode 100644 index 00000000..e5f5e01c --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Suggest/AbstractSuggest.php @@ -0,0 +1,92 @@ +_name = $name; + $this->setField($field); + } + + /** + * Suggest text must be set either globally or per suggestion + * @param string $text + * @return \Elastica\Suggest\AbstractSuggest + */ + public function setText($text) + { + $this->_text = $text; + return $this; + } + + /** + * @param string $field + * @return \Elastica\Suggest\AbstractSuggest + */ + public function setField($field) + { + return $this->setParam("field", $field); + } + + /** + * @param int $size + * @return \Elastica\Suggest\AbstractSuggest + */ + public function setSize($size) + { + return $this->setParam("size", $size); + } + + /** + * @param int $size maximum number of suggestions to be retrieved from each shard + * @return \Elastica\Suggest\AbstractSuggest + */ + public function setShardSize($size) + { + return $this->setParam("shard_size", $size); + } + + /** + * Retrieve the name of this suggestion + * @return string + */ + public function getName() + { + return $this->_name; + } + + /** + * @return array + */ + public function toArray() + { + $array = parent::toArray(); + if (isset($this->_text)) { + $array['text'] = $this->_text; + } + return $array; + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf