本文整理汇总了PHP中AbstractQuery::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractQuery::toArray方法的具体用法?PHP AbstractQuery::toArray怎么用?PHP AbstractQuery::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractQuery
的用法示例。
在下文中一共展示了AbstractQuery::toArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toArray
/**
* {@inheritdoc}
*/
public function toArray()
{
$array = parent::toArray();
if (isset($array['script'])) {
$array['script'] = $array['script']['script'];
}
return $array;
}
示例2: toArray
/**
* {@inheritdoc}
*/
public function toArray()
{
$array = parent::toArray();
$baseName = $this->_getBaseName();
if (isset($array[$baseName]['query'])) {
$array[$baseName]['query'] = $array[$baseName]['query']['query'];
}
return $array;
}
示例3: toArray
/**
* @return array
*/
public function toArray()
{
$array = parent::toArray();
// if there are no params, it's ok, but ES will throw exception if json
// will be like {"top_hits":[]} instead of {"top_hits":{}}
if (empty($array['inner_hits'])) {
$array['inner_hits'] = new \stdClass();
}
return $array['inner_hits'];
}
示例4: toArray
/**
* @return array
*/
public function toArray()
{
if (sizeof($this->_functions)) {
$this->setParam('functions', $this->_functions);
}
return parent::toArray();
}
示例5: toArray
/**
* Converts query to array
*
* @return array Query array
* @see \Elastica\Query\AbstractQuery::toArray()
*/
public function toArray()
{
$this->setParam($this->_field, array('query' => $this->_queryString));
return parent::toArray();
}
示例6: setQuery
/**
* Sets nested query.
*
* @param \Elastica\Query\AbstractQuery $query
*
* @return $this
*/
public function setQuery(AbstractQuery $query)
{
return $this->setParam('query', $query->toArray());
}
示例7: toArray
public function toArray()
{
$array = parent::toArray();
// If _id is provided, perform MLT on an existing document from the index
// If _source is provided, perform MLT on a document provided as an input
if (!empty($array['more_like_this']['like']['_id'])) {
$doc = $array['more_like_this']['like'];
$doc = array_intersect_key($doc, array('_index' => 1, '_type' => 1, '_id' => 1));
$array['more_like_this']['like'] = $doc;
} elseif (!empty($array['more_like_this']['like']['_source'])) {
$doc = $array['more_like_this']['like'];
$doc['doc'] = $array['more_like_this']['like']['_source'];
unset($doc['_id']);
unset($doc['_source']);
$array['more_like_this']['like'] = $doc;
}
return $array;
}
示例8: setNegativeQuery
/**
* Set the negative query for this Boosting Query
* @param AbstractQuery $query
* @return \Elastica\Query\Boosting
*/
public function setNegativeQuery(AbstractQuery $query)
{
return $this->setParam('negative', $query->toArray());
}
示例9: toArray
/**
* @see \Elastica\Param::toArray()
*
* @throws \Elastica\Exception\InvalidException
*
* @return array
*/
public function toArray()
{
$this->setParam($this->_key, $this->_getLocationData());
return parent::toArray();
}
示例10: toArray
/**
* @return array
*/
public function toArray()
{
$this->setParam($this->_field, $this->_queryParams);
return parent::toArray();
}
示例11: toArray
/**
* Converts fuzzy like this query to array.
*
* @return array Query array
*
* @see \Elastica\Query\AbstractQuery::toArray()
*/
public function toArray()
{
if (!empty($this->_fields)) {
$args['fields'] = $this->_fields;
}
if (!empty($this->_boost)) {
$args['boost'] = $this->_boost;
}
if (!empty($this->_analyzer)) {
$args['analyzer'] = $this->_analyzer;
}
$args['min_similarity'] = $this->_minSimilarity > 0 ? $this->_minSimilarity : 0;
$args['like_text'] = $this->_likeText;
$args['prefix_length'] = $this->_prefixLength;
$args['ignore_tf'] = $this->_ignoreTF;
$args['max_query_terms'] = $this->_maxQueryTerms;
$data = parent::toArray();
$args = array_merge($args, $data['fuzzy_like_this']);
return array('fuzzy_like_this' => $args);
}
示例12: toArray
/**
* Converts array to an object in case no queries are added.
*
* @return array
*/
public function toArray()
{
if (empty($this->_params)) {
$this->_params = new \stdClass();
}
return parent::toArray();
}
示例13: toArray
public function toArray()
{
$array = parent::toArray();
if (isset($array['more_like_this']['like']['_id'])) {
$doc = $array['more_like_this']['like'];
$doc = array_intersect_key($doc, array('_index' => 1, '_type' => 1, '_id' => 1));
$array['more_like_this']['like'] = $doc;
}
return $array;
}
示例14: toArray
/**
* Converts the terms object to an array.
*
* @see \Elastica\Query\AbstractQuery::toArray()
*
* @throws \Elastica\Exception\InvalidException If term key is empty
*
* @return array Query array
*/
public function toArray()
{
if (empty($this->_key)) {
throw new InvalidException('Terms key has to be set');
}
$this->setParam($this->_key, $this->_terms);
return parent::toArray();
}