* @license http://github.com/basdenooijer/solarium/raw/master/COPYING * @link http://www.solarium-project.org/ * * @package Solarium * @subpackage Client */ /** * Parse select component MoreLikeThis result from the data * * @package Solarium * @subpackage Client */ class Solarium_Client_ResponseParser_Select_Component_MoreLikeThis { /** * Parse result data into result objects * * @param Solarium_Query_Select $query * @param Solarium_Query_Select_Component_MoreLikeThis $moreLikeThis * @param array $data * @return Solarium_Result_Select_MoreLikeThis */ public function parse($query, $moreLikeThis, $data) { $results = array(); if (isset($data['moreLikeThis'])) { $documentClass = $query->getOption('documentclass'); $searchResults = $data['moreLikeThis']; foreach ($searchResults AS $key => $result) { // create document instances $docs = array(); foreach ($result['docs'] AS $fields) { $docs[] = new $documentClass($fields); } $results[$key] = new Solarium_Result_Select_MoreLikeThis_Result( $result['numFound'], $result['maxScore'], $docs ); } } return new Solarium_Result_Select_MoreLikeThis($results); } }