Executing debug through PHP code
To enable debugging of our Solr query using PHP, we need to get the debug component from our query.
In addition to getting debug information of the default query, we can call the explainOther()
function to get a score of certain documents that match the query specified in explainOther()
function with respect to the main query as shown in the following query:
$query->setQuery('cat:book OR author:martin^2'); $debugq = $query->getDebug(); $debugq->setExplainOther('author:king');
In the preceding piece of code, we are searching for all books and boosting books by author martin
by 2
. In addition to this we are getting the debug information for books by author king
.
After running the query, we need to get the debug component from the ResultSet
. We then use it to get the query string, parsed query string, the query parser and information about the debug other query as shown in the following code:
echo 'Querystring: ' . $dResultSet->getQueryString...