public function SearchApiQuery::__toString in Search API 7
Implements the magic __toString() method to simplify debugging.
File
- includes/
query.inc, line 841 - Contains SearchApiQueryInterface and SearchApiQuery.
Class
- SearchApiQuery
- Provides a standard implementation of the SearchApiQueryInterface.
Code
public function __toString() {
$ret = 'Index: ' . $this->index->machine_name . "\n";
$ret .= 'Keys: ' . str_replace("\n", "\n ", var_export($this->orig_keys, TRUE)) . "\n";
if (isset($this->keys)) {
$ret .= 'Parsed keys: ' . str_replace("\n", "\n ", var_export($this->keys, TRUE)) . "\n";
$ret .= 'Searched fields: ' . (isset($this->fields) ? implode(', ', $this->fields) : '[ALL]') . "\n";
}
if ($filter = (string) $this->filter) {
$filter = str_replace("\n", "\n ", $filter);
$ret .= "Filters:\n {$filter}\n";
}
if ($this->sort) {
$sort = array();
foreach ($this->sort as $field => $order) {
$sort[] = "{$field} {$order}";
}
$ret .= 'Sorting: ' . implode(', ', $sort) . "\n";
}
$options = $this
->sanitizeOptions($this->options);
$options = str_replace("\n", "\n ", var_export($options, TRUE));
$ret .= 'Options: ' . $options . "\n";
return $ret;
}