Elastica\Search::search PHP Method

    public function search($query = '', $options = null)
    {
        $this->setOptionsAndQuery($options, $query);
        $query = $this->getQuery();
        $path = $this->getPath();
        $params = $this->getOptions();
        // Send scroll_id via raw HTTP body to handle cases of very large (> 4kb) ids.
        if ('_search/scroll' == $path) {
            $data = $params[self::OPTION_SCROLL_ID];
            unset($params[self::OPTION_SCROLL_ID]);
        } else {
            $data = $query->toArray();
        }
        $response = $this->getClient()->request($path, Request::GET, $data, $params);
        return $this->_builder->buildResultSet($response, $query);
    }

Usage Example

コード例 #1
0
ファイル: ElasticaAdapter.php プロジェクト: kgilden/pager
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getItems($offset, $limit)
 {
     $query = $this->search->getQuery();
     $query->setFrom($offset);
     $query->setSize($limit);
     return $this->search->search()->getResults();
 }
All Usage Examples Of Elastica\Search::search