Commit 2b3eb876 authored by Bas de Nooijer's avatar Bas de Nooijer

Merge branch 'develop' of github.com:basdenooijer/solarium into develop

parents 042620b6 b5bf3b5a
......@@ -74,7 +74,7 @@ class MoreLikeThis implements ComponentParserInterface
$results[$key] = new Result(
$result['numFound'],
$result['maxScore'],
isset($result['maxScore']) ? $result['maxScore'] : null,
$docs
);
}
......
......@@ -72,7 +72,7 @@ class Result implements \IteratorAggregate, \Countable
* Constructor
*
* @param int $numFound
* @param float $maxScore
* @param float|null $maxScore
* @param array $documents
* @return void
*/
......
......@@ -77,4 +77,28 @@ class MoreLikeThisTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), $result->getResults());
}
public function testParseWithoutMaxScore()
{
$query = new Query();
$data = array(
'moreLikeThis' => array(
'id1' => array(
'numFound' => 12,
'docs' => array(
array('field1' => 'value1')
)
)
)
);
$docs = array(new Document(array('field1' => 'value1')));
$expected = array(
'id1' => new Result(12, null, $docs)
);
$result = $this->parser->parse($query, null, $data);
$this->assertEquals($expected, $result->getResults());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment