private function decodeSearchQuery($q)
    {
        $words = preg_split('|[\r\n\t ]+|', trim($q));

        $words = array_map(
            function ($word) {
                return mb_strtolower($word);
            },
            $words
        );
        $words = array_filter(
            $words,
            function ($word) {
                return strlen($word) >= 2;
            }
        );

        return [
            'valid' => count($words) > 0,
            'in_q'  => $q,
            'use_q' => implode(' ', $words),
            'sanitized_q' => strip_tags($q),
            'words' => $words,
        ];
    }
private function decodeSearchQuery($q)
    {
        $words = preg_split('|[\r\n\t ]+|', trim($q));

        $words = array_map(
            function ($word) {
                return mb_strtolower($word);
            },
            $words
        );
        $words = array_filter(
            $words,
            function ($word) {
                return strlen($word) >= 2;
            }
        );

        return [
            'valid' => count($words) > 0,
            'in_q'  => $q,
            'use_q' => implode(' ', $words),
            'sanitized_q' => strip_tags($q),
            'words' => $words,
        ];
    }
private function decodeSearchQuery ( $ q ) { $ words = preg_split ( '|[\r\n\t ]+|' , trim ( $ q ) ) ; $ words = array_map ( function ( $ word ) { return mb_strtolower ( $ word ) ; } , $ words ) ; $ words = array_filter ( $ words , function ( $ word ) { return strlen ( $ word ) >= 2 ; } ) ; return [ 'valid' => count ( $ words ) > 0 , 'in_q' => $ q , 'use_q' => implode ( ' ' , $ words ) , 'sanitized_q' => strip_tags ( $ q ) , 'words' => $ words , ] ; }
Decode search query into searchable parts.

@param string $q

@return array
Decode search query into searchable parts .