upadted to 1.8
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Views argument handler class for handling fulltext fields.
|
||||
*/
|
||||
class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgumentText {
|
||||
class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgument {
|
||||
|
||||
/**
|
||||
* Specify the options this filter uses.
|
||||
@@ -11,6 +11,7 @@ class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgumen
|
||||
public function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['fields'] = array('default' => array());
|
||||
$options['conjunction'] = array('default' => 'AND');
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -20,6 +21,8 @@ class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgumen
|
||||
public function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
|
||||
$form['help']['#markup'] = t('Note: You can change how search keys are parsed under "Advanced" > "Query settings".');
|
||||
|
||||
$fields = $this->getFulltextFields();
|
||||
if (!empty($fields)) {
|
||||
$form['fields'] = array(
|
||||
@@ -31,6 +34,17 @@ class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgumen
|
||||
'#multiple' => TRUE,
|
||||
'#default_value' => $this->options['fields'],
|
||||
);
|
||||
$form['conjunction'] = array(
|
||||
'#title' => t('Operator'),
|
||||
'#description' => t('Determines how multiple keywords entered for the search will be combined.'),
|
||||
'#type' => 'radios',
|
||||
'#options' => array(
|
||||
'AND' => t('Contains all of these words'),
|
||||
'OR' => t('Contains any of these words'),
|
||||
),
|
||||
'#default_value' => $this->options['conjunction'],
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
$form['fields'] = array(
|
||||
@@ -49,6 +63,9 @@ class SearchApiViewsHandlerArgumentFulltext extends SearchApiViewsHandlerArgumen
|
||||
if ($this->options['fields']) {
|
||||
$this->query->fields($this->options['fields']);
|
||||
}
|
||||
if ($this->options['conjunction'] != 'AND') {
|
||||
$this->query->setOption('conjunction', $this->options['conjunction']);
|
||||
}
|
||||
|
||||
$old = $this->query->getOriginalKeys();
|
||||
$this->query->keys($this->argument);
|
||||
|
||||
Reference in New Issue
Block a user