createSelect();
$query->setQuery('ipod');
// add debug settings
$debug = $query->getDebug();
$debug->setExplainOther('id:MA*');
// this executes the query and returns the result
$resultset = $client->select($query);
$debugResult = $resultset->getDebug();
// display the debug results
echo '
Debug data
';
echo 'Querystring: ' . $debugResult->getQueryString() . '
';
echo 'Parsed query: ' . $debugResult->getParsedQuery() . '
';
echo 'Query parser: ' . $debugResult->getQueryParser() . '
';
echo 'Other query: ' . $debugResult->getOtherQuery() . '
';
echo 'Explain data
';
foreach ($debugResult->getExplain() as $key => $explanation) {
echo 'Document key: ' . $key . '
';
echo 'Value: ' . $explanation->getValue() . '
';
echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
echo 'Description: ' . $explanation->getDescription() . '
';
echo 'Details
';
foreach ($explanation AS $detail) {
echo 'Value: ' . $detail->getValue() . '
';
echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
echo 'Description: ' . $detail->getDescription() . '
';
echo '
';
}
}
echo 'ExplainOther data
';
foreach ($debugResult->getExplainOther() as $key => $explanation) {
echo 'Document key: ' . $key . '
';
echo 'Value: ' . $explanation->getValue() . '
';
echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '
';
echo 'Description: ' . $explanation->getDescription() . '
';
echo 'Details
';
foreach ($explanation AS $detail) {
echo 'Value: ' . $detail->getValue() . '
';
echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '
';
echo 'Description: ' . $detail->getDescription() . '
';
echo '
';
}
}
echo 'Timings (in ms)
';
echo 'Total time: ' . $debugResult->getTiming()->getTime() . '
';
echo 'Phases
';
foreach ($debugResult->getTiming()->getPhases() as $phaseName => $phaseData) {
echo '' . $phaseName . '
';
foreach ($phaseData as $class => $time) {
echo $class . ': ' . $time . '
';
}
echo '
';
}
htmlFooter();