summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
new file mode 100644
index 00000000..ffaf5975
--- /dev/null
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
@@ -0,0 +1,78 @@
+<?php
+namespace Elastica\Filter;
+
+use Elastica\Index as ElasticaIndex;
+
+/**
+ * Class Indices.
+ *
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-indices-filter.html
+ */
+class Indices extends AbstractFilter
+{
+ /**
+ * @param AbstractFilter $filter filter which will be applied to docs in the specified indices
+ * @param mixed[] $indices
+ */
+ public function __construct(AbstractFilter $filter, array $indices)
+ {
+ $this->setIndices($indices)->setFilter($filter);
+ }
+
+ /**
+ * Set the indices on which this filter should be applied.
+ *
+ * @param mixed[] $indices
+ *
+ * @return $this
+ */
+ public function setIndices(array $indices)
+ {
+ $this->setParam('indices', array());
+ foreach ($indices as $index) {
+ $this->addIndex($index);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds one more index on which this filter should be applied.
+ *
+ * @param string|\Elastica\Index $index
+ *
+ * @return $this
+ */
+ public function addIndex($index)
+ {
+ if ($index instanceof ElasticaIndex) {
+ $index = $index->getName();
+ }
+
+ return $this->addParam('indices', (string) $index);
+ }
+
+ /**
+ * Set the filter to be applied to docs in the specified indices.
+ *
+ * @param AbstractFilter $filter
+ *
+ * @return $this
+ */
+ public function setFilter(AbstractFilter $filter)
+ {
+ return $this->setParam('filter', $filter->toArray());
+ }
+
+ /**
+ * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter.
+ *
+ * @param AbstractFilter $filter
+ *
+ * @return $this
+ */
+ public function setNoMatchFilter(AbstractFilter $filter)
+ {
+ return $this->setParam('no_match_filter', $filter->toArray());
+ }
+}