コード例 #1
0
ファイル: Query.php プロジェクト: comdan66/zeusdesign
 /**
  * @see Elastica_Param::toArray()
  */
 public function toArray()
 {
     $data = parent::toArray();
     $name = $this->_getBaseName();
     $filterData = $data[$name];
     if (empty($filterData)) {
         $filterData = $this->_query;
     } else {
         $filterData['query'] = $this->_query;
     }
     $data[$name] = $filterData;
     return $data;
 }
コード例 #2
0
ファイル: Abstract.php プロジェクト: technomagegithub/norma
 /**
  * Sets a filter for this facet.
  * 
  * @param Elastica_Filter_Abstract $filter A filter to apply on the facet.
  * @return Elastica_Facet_Abstract
  */
 public function setFilter(Elastica_Filter_Abstract $filter)
 {
     return $this->_setFacetParam('facet_filter', $filter->toArray());
 }
コード例 #3
0
ファイル: Range.php プロジェクト: nickdunn/Elastica
 /**
  * Convers object to array
  *
  * @see Elastica_Filter_Abstract::toArray()
  * @return array Filter array
  */
 public function toArray()
 {
     $this->setParams($this->_fields);
     return parent::toArray();
 }
コード例 #4
0
ファイル: CustomFiltersScore.php プロジェクト: ro-ka/Elastica
	/**
	 * Add a filter with a script to calculate the score
	 *
	 * @param Elastica_Filter_Abstract $filter Filter object
	 * @param Elastica_Script $script Script for calculating the score
	 * @return Elastica_Query_CustomFiltersScore Current object
	 */
	public function addFilterScript(Elastica_Filter_Abstract $filter, Elastica_Script $script) {
		$filterParam = array('filter' => $filter->toArray(), 'script' => $script->getScript());
		$this->addParam('filters', $filterParam);
		return $this;
	}
コード例 #5
0
ファイル: Prefix.php プロジェクト: technomagegithub/norma
 /**
  * Convers object to an arrray
  *
  * @see Elastica_Filter_Abstract::toArray()
  * @return array data array
  */
 public function toArray()
 {
     $this->setParam($this->_field, $this->_prefix);
     return parent::toArray();
 }
コード例 #6
0
 /**
  * Add a filter with boost
  *
  * @param Elastica_Filter_Abstract $filter Filter object
  * @param float $boost Boost for the filter
  * @return Elastica_Query_CustomFiltersScore Current object
  */
 public function addFilter(Elastica_Filter_Abstract $filter, $boost)
 {
     $filter_param = array('filter' => $filter->toArray(), 'boost' => $boost);
     $this->addParam('filters', $filter_param);
     return $this;
 }
コード例 #7
0
ファイル: Not.php プロジェクト: nnevala/zf-boilerplate
 public function __construct(Elastica_Filter_Abstract $filter)
 {
     $this->_filter = $filter->toArray();
 }
コード例 #8
0
ファイル: And.php プロジェクト: nnevala/zf-boilerplate
 public function addFilter(Elastica_Filter_Abstract $filter)
 {
     $this->_filters[] = $filter->toArray();
 }
コード例 #9
0
ファイル: GeoDistance.php プロジェクト: comdan66/zeusdesign
 /**
  * @see Elastica_Param::toArray()
  * @throws Elastica_Exception_Invalid
  */
 public function toArray()
 {
     $data = parent::toArray();
     // Add location to data array
     $filterName = $this->_getBaseName();
     $filterData = $data[$filterName];
     if ($this->_locationType === 'latlon') {
         // Latitude/longitude
         $location = array();
         if (isset($this->_latitude)) {
             // Latitude
             $location['lat'] = $this->_latitude;
         } else {
             throw new Elastica_Exception_Invalid('Latitude has to be set');
         }
         if (isset($this->_longitude)) {
             // Geohash
             $location['lon'] = $this->_longitude;
         } else {
             throw new Elastica_Exception_Invalid('Longitude has to be set');
         }
     } elseif ($this->_locationType === 'geohash') {
         // Geohash
         $location = $this->_geohash;
     } else {
         // Invalid location type
         throw new Elastica_Exception_Invalid('Invalid location type');
     }
     $filterData[$this->_key] = $location;
     $data[$filterName] = $filterData;
     return $data;
 }
コード例 #10
0
ファイル: And.php プロジェクト: technomagegithub/norma
 /**
  * Adds one more filter to the and filter
  *
  * @param Elastica_Filter_Abstract $filter
  * @return Elastica_Filter_And Current object
  */
 public function addFilter(Elastica_Filter_Abstract $filter)
 {
     $this->_params[] = $filter->toArray();
     return $this;
 }
コード例 #11
0
ファイル: Nested.php プロジェクト: nickdunn/elasticsearch
 /**
  * Sets nested filter
  * 
  * @param Elastica_Filter_Abstract $filter
  * @return Elastica_Filter_Nested
  */
 public function setFilter(Elastica_Filter_Abstract $filter)
 {
     return $this->setParam('query', $filter->toArray());
 }