protected function SearchApiStopWords::getStopWords in Search API 7
Retrieves the processor's configured stopwords.
Return value
array An array whose keys are the stopwords set in either the file or the text field.
1 call to SearchApiStopWords::getStopWords()
- SearchApiStopWords::process in includes/
processor_stopwords.inc - Function that is ultimately called for all text by the standard implementation, and does nothing by default.
File
- includes/
processor_stopwords.inc, line 95 - Contains SearchApiStopWords.
Class
- SearchApiStopWords
- Processor for removing stopwords from index and search terms.
Code
protected function getStopWords() {
if (isset($this->stopwords)) {
return $this->stopwords;
}
$file_words = $form_words = array();
if (!empty($this->options['file']) && ($stopwords_file = file_get_contents($this->options['file']))) {
$file_words = preg_split('/\\s+/', $stopwords_file);
}
if (!empty($this->options['stopwords'])) {
$form_words = preg_split('/\\s+/', $this->options['stopwords']);
}
$this->stopwords = array_flip(array_merge($file_words, $form_words));
return $this->stopwords;
}