From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- .../elastica/lib/Elastica/Aggregation/TopHits.php | 156 +++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 vendor/ruflin/elastica/lib/Elastica/Aggregation/TopHits.php (limited to 'vendor/ruflin/elastica/lib/Elastica/Aggregation/TopHits.php') diff --git a/vendor/ruflin/elastica/lib/Elastica/Aggregation/TopHits.php b/vendor/ruflin/elastica/lib/Elastica/Aggregation/TopHits.php new file mode 100644 index 00000000..91a48a48 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Aggregation/TopHits.php @@ -0,0 +1,156 @@ +setParam('size', (int) $size); + } + + /** + * The offset from the first result you want to fetch. + * + * @param int $from + * + * @return $this + */ + public function setFrom($from) + { + return $this->setParam('from', (int) $from); + } + + /** + * How the top matching hits should be sorted. By default the hits are sorted by the score of the main query. + * + * @param array $sortArgs + * + * @return $this + */ + public function setSort(array $sortArgs) + { + return $this->setParam('sort', $sortArgs); + } + + /** + * Allows to control how the _source field is returned with every hit. + * + * @param array $fields + * + * @return $this + */ + public function setSource(array $fields) + { + return $this->setParam('_source', $fields); + } + + /** + * Returns a version for each search hit. + * + * @param bool $version + * + * @return $this + */ + public function setVersion($version) + { + return $this->setParam('version', (bool) $version); + } + + /** + * Enables explanation for each hit on how its score was computed. + * + * @param bool $explain + * + * @return $this + */ + public function setExplain($explain) + { + return $this->setParam('explain', (bool) $explain); + } + + /** + * Set script fields. + * + * @param array|\Elastica\ScriptFields $scriptFields + * + * @return $this + */ + public function setScriptFields($scriptFields) + { + if (is_array($scriptFields)) { + $scriptFields = new ScriptFields($scriptFields); + } + + return $this->setParam('script_fields', $scriptFields->toArray()); + } + + /** + * Adds a Script to the aggregation. + * + * @param string $name + * @param \Elastica\Script $script + * + * @return $this + */ + public function addScriptField($name, Script $script) + { + $this->_params['script_fields'][$name] = $script->toArray(); + + return $this; + } + + /** + * Sets highlight arguments for the results. + * + * @param array $highlightArgs + * + * @return $this + */ + public function setHighlight(array $highlightArgs) + { + return $this->setParam('highlight', $highlightArgs); + } + + /** + * Allows to return the field data representation of a field for each hit. + * + * @param array $fields + * + * @return $this + */ + public function setFieldDataFields(array $fields) + { + return $this->setParam('fielddata_fields', $fields); + } +} -- cgit v1.2.3-54-g00ecf