public function testNotMerged()
 {
     $query = new Simples_Request_Search_Builder_Query();
     $query->must()->match('scharrier')->in(array('username', 'retweet'))->field('category_id')->match(array('1', '2', '3'))->not()->field('type')->match('administreur');
     $res = $query->to('array');
     $this->assertEquals(2, count($res['bool']['must']));
     $this->assertEquals(1, count($res['bool']['must_not']));
 }
Exemple #2
0
 /**
  * Add multiples field queries one time. It's a simplified call wich permit to give this kind of array :
  * $request->queries(array(
  *		'field' => 'value',
  *		'other_field' => array('value 1', 'value 2')
  * ));
  * 
  * @param array $queries			List of criteries. Field name in key, search in value.
  * @return \Simples_Request_Search	This instance.
  */
 public function queries(array $queries)
 {
     // Save current subobject
     $this->_current = 'query';
     $this->_fluid = true;
     foreach ($queries as $in => $match) {
         $this->_query->add(array('query' => $match, 'in' => $in));
     }
     return $this;
 }