upadted to 1.8

This commit is contained in:
Bachir Soussi Chiadmi
2013-09-26 15:49:26 +02:00
parent e0ae80791b
commit 128640cd15
52 changed files with 2604 additions and 1015 deletions
+21 -7
View File
@@ -18,6 +18,17 @@ class SearchApiTokenizer extends SearchApiAbstractProcessor {
public function configurationForm() {
$form = parent::configurationForm();
// Only make fulltext fields available as options.
$fields = $this->index->getFields();
$field_options = array();
foreach ($fields as $name => $field) {
if (empty($field['real_type']) && search_api_is_text_type($field['type'])) {
$field_options[$name] = $field['name'];
}
}
$form['fields']['#options'] = $field_options;
$form += array(
'spaces' => array(
'#type' => 'textfield',
@@ -37,7 +48,7 @@ class SearchApiTokenizer extends SearchApiAbstractProcessor {
);
if (!empty($this->options)) {
$form['spaces']['#default_value'] = $this->options['spaces'];
$form['spaces']['#default_value'] = $this->options['spaces'];
$form['ignorable']['#default_value'] = $this->options['ignorable'];
}
@@ -76,12 +87,15 @@ class SearchApiTokenizer extends SearchApiAbstractProcessor {
}
protected function process(&$value) {
$this->prepare();
if ($this->ignorable) {
$value = preg_replace('/' . $this->ignorable . '+/u', '', $value);
}
if ($this->spaces) {
$value = preg_replace('/' . $this->spaces . '+/u', ' ', $value);
// We don't touch integers, NULL values or the like.
if (is_string($value)) {
$this->prepare();
if ($this->ignorable) {
$value = preg_replace('/' . $this->ignorable . '+/u', '', $value);
}
if ($this->spaces) {
$value = preg_replace('/' . $this->spaces . '+/u', ' ', $value);
}
}
}