setBoost() публичный Метод

Sets boost value of this query.
public setBoost ( float $boost )
$boost float Boost value
Пример #1
0
 /**
  * @group unit
  */
 public function testToArray()
 {
     $query = new BoolQuery();
     $idsQuery1 = new Ids();
     $idsQuery1->setIds(1);
     $idsQuery2 = new Ids();
     $idsQuery2->setIds(2);
     $idsQuery3 = new Ids();
     $idsQuery3->setIds(3);
     $filter1 = new TermFilter();
     $filter1->setTerm('test', '1');
     $filter2 = new TermFilter();
     $filter2->setTerm('username', 'ruth');
     $boost = 1.2;
     $minMatch = 2;
     $query->setBoost($boost);
     $query->setMinimumNumberShouldMatch($minMatch);
     $query->addMust($idsQuery1);
     $query->addMustNot($idsQuery2);
     $query->addShould($idsQuery3->toArray());
     $query->addFilter($filter1);
     $query->addFilter($filter2);
     $expectedArray = array('bool' => array('must' => array($idsQuery1->toArray()), 'should' => array($idsQuery3->toArray()), 'filter' => array($filter1->toArray(), $filter2->toArray()), 'minimum_number_should_match' => $minMatch, 'must_not' => array($idsQuery2->toArray()), 'boost' => $boost));
     $this->assertEquals($expectedArray, $query->toArray());
 }