Skip to content

Commit

Permalink
Fix setType for Ids query (#1124) (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenExe authored and ruflin committed Aug 23, 2016
1 parent 045ee26 commit 0ffd884
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Elastica/Query/Ids.php
Expand Up @@ -64,7 +64,7 @@ public function addType($type)
/**
* Set type.
*
* @param string|\Elastica\Type $type Type name or object
* @param array|string|\Elastica\Type $type Type name or object
*
* @return $this
*/
Expand All @@ -77,7 +77,7 @@ public function setType($type)
return $this;
}

$this->_params['type'] = $type;
$this->_params['type'] = (array)$type;

return $this;
}
Expand Down
16 changes: 16 additions & 0 deletions test/lib/Elastica/Test/Query/IdsTest.php
Expand Up @@ -156,6 +156,22 @@ public function testSetTypeSingleSearchArrayDocInOtherType()
$this->assertEquals(1, $resultSet->count());
}

/**
* @group functional
*/
public function testSetTypeAndAddType()
{
$query = new Ids();

$query->setIds(['1', '4']);
$query->setType('helloworld1');
$query->addType('helloworld2');

$resultSet = $this->_index->search($query);

$this->assertEquals(2, $resultSet->count());
}

/**
* @group functional
*/
Expand Down

0 comments on commit 0ffd884

Please sign in to comment.