public function testGetQuery() { $client = new Client(); $query = new Query(); $response = new Response('{"responseHeader":{"status":1,"QTime":12}}', array('HTTP 1.1 200 OK')); $ping = new Result($client, $query, $response); $this->assertEquals($query, $ping->getQuery()); }
/** * Get result data for the response * * @param Result $result * @return array */ public function parse($result) { $data = $result->getData(); $query = $result->getQuery(); $parseResult = parent::parse($result); if (isset($data['interestingTerms']) && 'none' != $query->getInterestingTerms()) { $terms = $data['interestingTerms']; if ('details' == $query->getInterestingTerms()) { if ($query->getResponseWriter() == $query::WT_JSON) { $terms = $this->convertToKeyValueArray($terms); } } $parseResult['interestingTerms'] = $terms; } 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; }