', '<', ':', ';', '^', '$' ]; foreach ($operators as $operator) { $query = str_ireplace($operator, '\\' . $operator, $query); } // Apply separators $query = str_replace(['-', '_', '/'], ' ', $query); // Apply query MATCH rules if (false !== strpos($query, '\:\ \ ')) { // URL request $query = sprintf('"%s"', $crc32query); } else if (mb_strlen($query) > 68) { // @TODO Queries longer than 68 chars unreachable in search index $query = sprintf('"%s" | (%s*)', $crc32query, substr($query, 0, 67)); } else { // Default condition $words = []; // Remove single char words foreach ((array) explode(' ', $query) as $word) { if (mb_strlen($word) > 1) { $words[] = sprintf('(%s*)', $word); } } $query = sprintf('@title %s | "%s" | (%s)', $query, $crc32query, implode(' | ', $words)); } } return trim($query); } static public function plural(int $number, array $texts) { $cases = array (2, 0, 1, 1, 1, 2); return $texts[(($number % 100) > 4 && ($number % 100) < 20) ? 2 : $cases[min($number % 10, 5)]]; } }