Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
3122c3c6
Commit
3122c3c6
authored
Jul 12, 2013
by
Corentin Larose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix proposition for maxScore related notice + unit test (Issue #175)
parent
c3791415
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
library/Solarium/QueryType/Select/ResponseParser/Component/MoreLikeThis.php
...ueryType/Select/ResponseParser/Component/MoreLikeThis.php
+1
-1
library/Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
.../Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
+1
-1
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/MoreLikeThisTest.php
...Type/Select/ResponseParser/Component/MoreLikeThisTest.php
+24
-0
No files found.
library/Solarium/QueryType/Select/ResponseParser/Component/MoreLikeThis.php
View file @
3122c3c6
...
...
@@ -74,7 +74,7 @@ class MoreLikeThis implements ComponentParserInterface
$results
[
$key
]
=
new
Result
(
$result
[
'numFound'
],
$result
[
'maxScore'
]
,
isset
(
$result
[
'maxScore'
])
?
$result
[
'maxScore'
]
:
null
,
$docs
);
}
...
...
library/Solarium/QueryType/Select/Result/MoreLikeThis/Result.php
View file @
3122c3c6
...
...
@@ -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
*/
...
...
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/MoreLikeThisTest.php
View file @
3122c3c6
...
...
@@ -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
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment