mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Fix movie and tv searches
This commit is contained in:
@@ -1636,6 +1636,16 @@ class ReleaseSearchService
|
||||
$query->where($field, 'LIKE', '%'.$term.'%');
|
||||
}
|
||||
}
|
||||
|
||||
if ($field === 'searchname' && count($terms) > 1) {
|
||||
$normalizedPhrase = $this->normalizeMysqlFallbackPhrase($value);
|
||||
if ($normalizedPhrase !== '') {
|
||||
$query->whereRaw(
|
||||
"LOWER(REPLACE(REPLACE(REPLACE($field, '.', ' '), '-', ' '), '_', ' ')) LIKE ?",
|
||||
[$normalizedPhrase.'%']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1655,6 +1665,15 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
private function normalizeMysqlFallbackPhrase(string $value): string
|
||||
{
|
||||
$normalized = strtolower(trim($value));
|
||||
$normalized = str_replace(['.', '-', '_'], ' ', $normalized);
|
||||
$normalized = preg_replace('/\s+/', ' ', $normalized);
|
||||
|
||||
return trim((string) $normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $siteIdArr
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user