Elastica\Search::addType PHP Method

addType() public method

Adds a type to the current search.
public addType ( Type | string $type )
$type Type | string Type name or object
    public function addType($type)
    {
        if ($type instanceof Type) {
            $type = $type->getName();
        }
        if (!is_string($type)) {
            throw new InvalidException('Invalid type type');
        }
        $this->_types[] = $type;
        return $this;
    }

Usage Example

コード例 #1
0
 /**
  * @return \Elastica\ResultSet
  */
 public function getSearchResult()
 {
     $index = $this->search->getIndex($this->getIndexName() . '_' . $this->language);
     $search = new Search($this->search->getClient());
     $search->addIndex($index);
     $search->addType($index->getType($this->indexType));
     $result = $search->search($this->query);
     return $result;
 }
All Usage Examples Of Elastica\Search::addType