Commit 6322500a authored by Bas de Nooijer's avatar Bas de Nooijer

- added support for parsing the matched doc

- small style and phpdoc fixes
parent ad0f9888
...@@ -43,14 +43,13 @@ ...@@ -43,14 +43,13 @@
* @package Solarium * @package Solarium
* @subpackage Client * @subpackage Client
*/ */
class Solarium_Client_ResponseParser_MoreLikeThis class Solarium_Client_ResponseParser_MoreLikeThis extends Solarium_Client_ResponseParser_Select
extends Solarium_Client_ResponseParser_Select
{ {
/** /**
* Get result data for the response * Get result data for the response
* *
* @param Solarium_Result_Select $result * @param Solarium_Result_MoreLikeThis $result
* @return array * @return array
*/ */
public function parse($result) public function parse($result)
...@@ -58,10 +57,8 @@ class Solarium_Client_ResponseParser_MoreLikeThis ...@@ -58,10 +57,8 @@ class Solarium_Client_ResponseParser_MoreLikeThis
$data = $result->getData(); $data = $result->getData();
$query = $result->getQuery(); $query = $result->getQuery();
$postResult = parent::parse($result); $parseResult = parent::parse($result);
if (isset($data['interestingTerms']) if (isset($data['interestingTerms']) && 'none' != $query->getInterestingTerms()) {
and 'none' != $query->getInterestingTerms()
) {
$terms = $data['interestingTerms']; $terms = $data['interestingTerms'];
if ('details' == $query->getInterestingTerms()) { if ('details' == $query->getInterestingTerms()) {
$tempTerms = array(); $tempTerms = array();
...@@ -70,9 +67,18 @@ class Solarium_Client_ResponseParser_MoreLikeThis ...@@ -70,9 +67,18 @@ class Solarium_Client_ResponseParser_MoreLikeThis
} }
$terms = $tempTerms; $terms = $tempTerms;
} }
$postResult['interestingTerms'] = $terms; $parseResult['interestingTerms'] = $terms;
} }
return $postResult;
if (isset($data['match']['docs'][0]) && true == $query->getMatchInclude()) {
$matchData = $data['match']['docs'][0];
$documentClass = $query->getOption('documentclass');
$fields = (array)$matchData;
$parseResult['match'] = new $documentClass($fields);
}
return $parseResult;
} }
} }
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