public function SearchApiMultiQuery::__toString in Search API Multi-Index Searches 7
Implements the magic __toString() method to simplify debugging.
File
- ./
search_api_multi.query.inc, line 1157
Class
- SearchApiMultiQuery
- Standard implementation of SearchApiMultiQueryInterface.
Code
public function __toString() {
$ret = '';
if ($this->indexes) {
$indexes = array();
foreach ($this->indexes as $index) {
$indexes[] = $index->machine_name;
}
$ret .= 'Indexes: ' . implode(', ', $indexes) . "\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;
}