protected function _beforeRepositoryFetch(AnCommandContext $context)
    {
        $query = $context->query;

        if ($query->keyword) {
            $keywords = $query->keyword;

            if ($keywords) {
                if (strpos($keywords, ' OR ')) {
                    $keywords = explode(' OR ', $keywords);
                    $operation = 'OR';
                } else {
                    $keywords = explode(' ', $keywords);
                    $operation = 'AND';
                }

                if (!empty($operation)) {
                    $clause = $query->clause();
                    $search_column = array();

                    foreach ($this->_searchable_properties as $property) {
                        $search_column[] = "IF(@col($property) IS NULL,\"\",@col($property))";
                    }

                    $search_column = implode($search_column, ',');

                    foreach ($keywords as $keyword) {
                        $clause->where('CONCAT('.$search_column.') LIKE @quote(%'.$keyword.'%)', $operation);
                    }
                }
            }
        }
    }
protected function _beforeRepositoryFetch(AnCommandContext $context)
    {
        $query = $context->query;

        if ($query->keyword) {
            $keywords = $query->keyword;

            if ($keywords) {
                if (strpos($keywords, ' OR ')) {
                    $keywords = explode(' OR ', $keywords);
                    $operation = 'OR';
                } else {
                    $keywords = explode(' ', $keywords);
                    $operation = 'AND';
                }

                if (!empty($operation)) {
                    $clause = $query->clause();
                    $search_column = array();

                    foreach ($this->_searchable_properties as $property) {
                        $search_column[] = "IF(@col($property) IS NULL,\"\",@col($property))";
                    }

                    $search_column = implode($search_column, ',');

                    foreach ($keywords as $keyword) {
                        $clause->where('CONCAT('.$search_column.') LIKE @quote(%'.$keyword.'%)', $operation);
                    }
                }
            }
        }
    }
protected function _beforeRepositoryFetch ( AnCommandContext $ context ) { $ query = $ context -> query ; if ( $ query -> keyword ) { $ keywords = $ query -> keyword ; if ( $ keywords ) { if ( strpos ( $ keywords , ' OR ' ) ) { $ keywords = explode ( ' OR ' , $ keywords ) ; $ operation = 'OR' ; } else { $ keywords = explode ( ' ' , $ keywords ) ; $ operation = 'AND' ; } if ( ! empty ( $ operation ) ) { $ clause = $ query -> clause ( ) ; $ search_column = array ( ) ; foreach ( $ this -> _searchable_properties as $ property ) { $ search_column [ ] = "IF(@col($property) IS NULL,\"\",@col($property))" ; } $ search_column = implode ( $ search_column , ',' ) ; foreach ( $ keywords as $ keyword ) { $ clause -> where ( 'CONCAT(' . $ search_column . ') LIKE @quote(%' . $ keyword . '%)' , $ operation ) ; } } } } }
If a query keyowrd is set it will incorporate it in the search.

@param AnCommandContext $context
If a query keyowrd is set it will incorporate it in the search .