[7588] | 1 | <?php |
---|
| 2 | |
---|
| 3 | require('init.php'); |
---|
| 4 | htmlHeader(); |
---|
| 5 | |
---|
| 6 | // create a client instance |
---|
| 7 | $client = new Solarium_Client($config); |
---|
| 8 | |
---|
| 9 | // get a select query instance |
---|
| 10 | $query = $client->createSelect(); |
---|
| 11 | $query->setQuery('ipod'); |
---|
| 12 | |
---|
| 13 | // add debug settings |
---|
| 14 | $debug = $query->getDebug(); |
---|
| 15 | $debug->setExplainOther('id:MA*'); |
---|
| 16 | |
---|
| 17 | // this executes the query and returns the result |
---|
| 18 | $resultset = $client->select($query); |
---|
| 19 | $debugResult = $resultset->getDebug(); |
---|
| 20 | |
---|
| 21 | // display the debug results |
---|
| 22 | echo '<h1>Debug data</h1>'; |
---|
| 23 | echo 'Querystring: ' . $debugResult->getQueryString() . '<br/>'; |
---|
| 24 | echo 'Parsed query: ' . $debugResult->getParsedQuery() . '<br/>'; |
---|
| 25 | echo 'Query parser: ' . $debugResult->getQueryParser() . '<br/>'; |
---|
| 26 | echo 'Other query: ' . $debugResult->getOtherQuery() . '<br/>'; |
---|
| 27 | |
---|
| 28 | echo '<h2>Explain data</h2>'; |
---|
| 29 | foreach ($debugResult->getExplain() as $key => $explanation) { |
---|
| 30 | echo '<h3>Document key: ' . $key . '</h3>'; |
---|
| 31 | echo 'Value: ' . $explanation->getValue() . '<br/>'; |
---|
| 32 | echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '<br/>'; |
---|
| 33 | echo 'Description: ' . $explanation->getDescription() . '<br/>'; |
---|
| 34 | echo '<h4>Details</h4>'; |
---|
| 35 | foreach ($explanation AS $detail) { |
---|
| 36 | echo 'Value: ' . $detail->getValue() . '<br/>'; |
---|
| 37 | echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '<br/>'; |
---|
| 38 | echo 'Description: ' . $detail->getDescription() . '<br/>'; |
---|
| 39 | echo '<hr/>'; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | echo '<h2>ExplainOther data</h2>'; |
---|
| 44 | foreach ($debugResult->getExplainOther() as $key => $explanation) { |
---|
| 45 | echo '<h3>Document key: ' . $key . '</h3>'; |
---|
| 46 | echo 'Value: ' . $explanation->getValue() . '<br/>'; |
---|
| 47 | echo 'Match: ' . (($explanation->getMatch() == true) ? 'true' : 'false') . '<br/>'; |
---|
| 48 | echo 'Description: ' . $explanation->getDescription() . '<br/>'; |
---|
| 49 | echo '<h4>Details</h4>'; |
---|
| 50 | foreach ($explanation AS $detail) { |
---|
| 51 | echo 'Value: ' . $detail->getValue() . '<br/>'; |
---|
| 52 | echo 'Match: ' . (($detail->getMatch() == true) ? 'true' : 'false') . '<br/>'; |
---|
| 53 | echo 'Description: ' . $detail->getDescription() . '<br/>'; |
---|
| 54 | echo '<hr/>'; |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | echo '<h2>Timings (in ms)</h2>'; |
---|
| 59 | echo 'Total time: ' . $debugResult->getTiming()->getTime() . '<br/>'; |
---|
| 60 | echo '<h3>Phases</h3>'; |
---|
| 61 | foreach ($debugResult->getTiming()->getPhases() as $phaseName => $phaseData) { |
---|
| 62 | echo '<h4>' . $phaseName . '</h4>'; |
---|
| 63 | foreach ($phaseData as $class => $time) { |
---|
| 64 | echo $class . ': ' . $time . '<br/>'; |
---|
| 65 | } |
---|
| 66 | echo '<hr/>'; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | htmlFooter(); |
---|