summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php57
1 files changed, 42 insertions, 15 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
index 66ca5965..ffaf5975 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/Indices.php
@@ -1,18 +1,18 @@
<?php
-
namespace Elastica\Filter;
+use Elastica\Index as ElasticaIndex;
/**
- * Class Indices
- * @package Elastica\Filter
- * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-indices-filter.html
+ * 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 string[] $indices
+ * @param AbstractFilter $filter filter which will be applied to docs in the specified indices
+ * @param mixed[] $indices
*/
public function __construct(AbstractFilter $filter, array $indices)
{
@@ -20,19 +20,44 @@ class Indices extends AbstractFilter
}
/**
- * Set the names of the indices on which this filter should be applied
- * @param string[] $indices
- * @return Indices
+ * Set the indices on which this filter should be applied.
+ *
+ * @param mixed[] $indices
+ *
+ * @return $this
*/
public function setIndices(array $indices)
{
- return $this->setParam('indices', $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
+ * Set the filter to be applied to docs in the specified indices.
+ *
* @param AbstractFilter $filter
- * @return Indices
+ *
+ * @return $this
*/
public function setFilter(AbstractFilter $filter)
{
@@ -40,12 +65,14 @@ class Indices extends AbstractFilter
}
/**
- * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter
+ * Set the filter to be applied to docs in indices which do not match those specified in the "indices" parameter.
+ *
* @param AbstractFilter $filter
- * @return Indices
+ *
+ * @return $this
*/
public function setNoMatchFilter(AbstractFilter $filter)
{
return $this->setParam('no_match_filter', $filter->toArray());
}
-} \ No newline at end of file
+}