/** * @group functional */ public function testSetMinScore() { $this->_checkVersion('1.5'); $expected = array('function_score' => array('min_score' => 0.8, 'functions' => array(array('gauss' => array('price' => array('origin' => 0, 'scale' => 10)))))); $query = new FunctionScore(); $query->addDecayFunction(FunctionScore::DECAY_GAUSS, 'price', 0, 10); $returnedValue = $query->setMinScore(0.8); $this->assertEquals($expected, $query->toArray()); $this->assertInstanceOf('Elastica\\Query\\FunctionScore', $returnedValue); $response = $this->_getIndexForTest()->search($query); $results = $response->getResults(); $this->assertCount(1, $results); $this->assertEquals(1, $results[0]->getId()); }