mirror of https://github.com/Jackett/Jackett
DonTorrent: Allow multiple words search (#15310)
This commit is contained in:
parent
044d8c0f4f
commit
1059d32dd3
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue