DrupalApacheSolrMultilingualService.php in Apache Solr Multilingual 7
File
DrupalApacheSolrMultilingualService.php
View source
<?php
class DrupalApacheSolrMultilingualService extends DrupalApacheSolrService {
protected function _makeHttpRequest($url, array $options = array()) {
if (!isset($options['method']) || $options['method'] == 'GET' || $options['method'] == 'HEAD') {
$options['data'] = NULL;
}
$options += array(
'timeout' => variable_get('apachesolr_connection_timeout', '600.0'),
);
$result = drupal_http_request($url, $options);
if (!isset($result->code) || $result->code < 0) {
$result->code = 0;
$result->status_message = 'Request failed';
$result->protocol = 'HTTP/1.0';
}
if (isset($result->error)) {
$result->status_message .= ': ' . check_plain($result->error);
}
if (!isset($result->data)) {
$result->data = '';
$result->response = NULL;
}
else {
$language_ids = array_keys(apachesolr_multilingual_language_list());
foreach ($language_ids as $language_id) {
$result->data = preg_replace('@"spellcheck"@', '"spellcheck_' . $language_id . '"', $result->data, 1);
}
$response = json_decode($result->data);
if (is_object($response)) {
foreach ($response as $key => $value) {
$result->{$key} = $value;
}
}
}
return $result;
}
}
Classes
Name |
Description |
DrupalApacheSolrMultilingualService |
Class DrupalApacheSolrMultilingualService extends DrupalApacheSolrService
and overrides the internal method _makeHttpRequest to deal with multilingual
spell checking. |