DonTorrent: Allow multiple words search (#15310)

This commit is contained in:
jojojox2 2024-05-17 19:01:17 +02:00 committed by GitHub
parent 044d8c0f4f
commit 1059d32dd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 14 deletions

View File

@ -275,8 +275,7 @@ namespace Jackett.Common.Indexers
private async Task<List<ReleaseInfo>> PerformQuerySearch(TorznabQuery query, bool matchWords) private async Task<List<ReleaseInfo>> PerformQuerySearch(TorznabQuery query, bool matchWords)
{ {
var releases = new List<ReleaseInfo>(); var releases = new List<ReleaseInfo>();
// search only the longest word, we filter the results later var searchTerm = query.SearchTerm;
var searchTerm = GetLongestWord(query.SearchTerm);
var url = SiteLink + SearchUrl + searchTerm; var url = SiteLink + SearchUrl + searchTerm;
var result = await RequestWithCookiesAsync(url, referer: url); var result = await RequestWithCookiesAsync(url, referer: url);
if (result.Status != HttpStatusCode.OK) if (result.Status != HttpStatusCode.OK)
@ -737,18 +736,6 @@ namespace Jackett.Common.Indexers
.FirstOrDefault(); .FirstOrDefault();
} }
private static string GetLongestWord(string text)
{
var words = text.Split(' ');
if (!words.Any())
return null;
var longestWord = words.First();
foreach (var word in words)
if (word.Length >= longestWord.Length)
longestWord = word;
return longestWord;
}
private static DateTime TryToParseDate(string dateToParse, DateTime dateDefault) private static DateTime TryToParseDate(string dateToParse, DateTime dateDefault)
{ {
try try