protected function setSearchIndexableData(array &$data, $locale = 'fr') { if ($this->isSearchIndexable() && (!isset($data[$this->getSearchWordsColumn()]) || empty($data[$this->getSearchWordsColumn()]))) { $words = ''; foreach ($data as $column => $values) { if (in_array($column, $this->getSearchIndexableColumns())) { $words .= $values . ' '; } } $words = Modifiers::toIndexes($words); $aStopWords = $this->app['stopwords']->get($locale); $data[$this->getSearchWordsColumn()] = implode(' ', array_diff($words, $aStopWords)); } }
protected function searchColumn(QueryBuilder $queryBuilder, $model, $from, $in = null, array $params = []) { if (null === $in) { $in = $from; } if ($this->aCriteria[$from]) { $this->aCriteria[$from . '-words'] = Modifiers::toIndexes($this->aCriteria[$from]); if (!empty($this->aCriteria[$from . '-words'])) { $queryBuilder->searchInColumn($model, $in, $this->aCriteria[$from . '-words'], $params); } else { $this->aCriteria[$from] = $this->aCriteria[$from . '-words'] = null; } } else { $this->aCriteria[$from] = $this->aCriteria[$from . '-words'] = null; } }