protected function _getFulltextSearchConditions($conditionField, $value, array $options)
    {
        $searchTerms = explode(' ', $value);
        $searchTerms = array_map('trim', $searchTerms);
        $searchTerms = array_map('mb_strtolower', $searchTerms);

        if (isset($options['termsCallback']) && is_callable($options['termsCallback'])) {
            $searchTerms = $options['termsCallback']($searchTerms);
        }

        $searchFields = [$conditionField];
        if (!empty($options['searchFields'])) {
            $searchFields = $options['searchFields'];
        }
        $conditions = [];
        $conjunction = $this->config['searchTermsConjunction'];
        foreach ($searchTerms as $key => $term) {
            $searchFieldConditions = [];

            if (is_array($term)) {
                foreach ($term as $item) {
                    foreach ($searchFields as $searchField) {
                        $searchFieldConditions["{$searchField} LIKE"] = "%{$item}%";
                    }

                    $conditions[$conjunction][$key]['OR'][] = [
                        'OR' => $searchFieldConditions
                    ];
                }
            } else {
                foreach ($searchFields as $searchField) {
                    $searchFieldConditions["{$searchField} LIKE"] = "%{$term}%";
                }

                $conditions[$conjunction][$key] = [
                    'OR' => $searchFieldConditions
                ];
            }
        }

        return $conditions;
    }
protected function _getFulltextSearchConditions($conditionField, $value, array $options)
    {
        $searchTerms = explode(' ', $value);
        $searchTerms = array_map('trim', $searchTerms);
        $searchTerms = array_map('mb_strtolower', $searchTerms);

        if (isset($options['termsCallback']) && is_callable($options['termsCallback'])) {
            $searchTerms = $options['termsCallback']($searchTerms);
        }

        $searchFields = [$conditionField];
        if (!empty($options['searchFields'])) {
            $searchFields = $options['searchFields'];
        }
        $conditions = [];
        $conjunction = $this->config['searchTermsConjunction'];
        foreach ($searchTerms as $key => $term) {
            $searchFieldConditions = [];

            if (is_array($term)) {
                foreach ($term as $item) {
                    foreach ($searchFields as $searchField) {
                        $searchFieldConditions["{$searchField} LIKE"] = "%{$item}%";
                    }

                    $conditions[$conjunction][$key]['OR'][] = [
                        'OR' => $searchFieldConditions
                    ];
                }
            } else {
                foreach ($searchFields as $searchField) {
                    $searchFieldConditions["{$searchField} LIKE"] = "%{$term}%";
                }

                $conditions[$conjunction][$key] = [
                    'OR' => $searchFieldConditions
                ];
            }
        }

        return $conditions;
    }
protected function _getFulltextSearchConditions ( $ conditionField , $ value , array $ options ) { $ searchTerms = explode ( ' ' , $ value ) ; $ searchTerms = array_map ( 'trim' , $ searchTerms ) ; $ searchTerms = array_map ( 'mb_strtolower' , $ searchTerms ) ; if ( isset ( $ options [ 'termsCallback' ] ) && is_callable ( $ options [ 'termsCallback' ] ) ) { $ searchTerms = $ options [ 'termsCallback' ] ( $ searchTerms ) ; } $ searchFields = [ $ conditionField ] ; if ( ! empty ( $ options [ 'searchFields' ] ) ) { $ searchFields = $ options [ 'searchFields' ] ; } $ conditions = [ ] ; $ conjunction = $ this -> config [ 'searchTermsConjunction' ] ; foreach ( $ searchTerms as $ key => $ term ) { $ searchFieldConditions = [ ] ; if ( is_array ( $ term ) ) { foreach ( $ term as $ item ) { foreach ( $ searchFields as $ searchField ) { $ searchFieldConditions [ "{$searchField} LIKE" ] = "%{$item}%" ; } $ conditions [ $ conjunction ] [ $ key ] [ 'OR' ] [ ] = [ 'OR' => $ searchFieldConditions ] ; } } else { foreach ( $ searchFields as $ searchField ) { $ searchFieldConditions [ "{$searchField} LIKE" ] = "%{$term}%" ; } $ conditions [ $ conjunction ] [ $ key ] = [ 'OR' => $ searchFieldConditions ] ; } } return $ conditions ; }
Splits the search term in value to multiple terms and constructs a OR-style
conditions array for each term, for each field to be searched.

@param string $conditionField Primary field to search in
@param string $value Search Term
@param array $options Filter configuration
@return array
Splits the search term in value to multiple terms and constructs a OR - style conditions array for each term for each field to be searched .