Fixed: (Nebunlance) Enable RawSearch and strip non-word chars

pull/1482/head
Bogdan 2 years ago
parent 99d315979e
commit 8323d13a1d

@ -66,7 +66,8 @@ namespace NzbDrone.Core.Indexers.Definitions
TvSearchParams = new List<TvSearchParam> TvSearchParams = new List<TvSearchParam>
{ {
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvMazeId TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvMazeId
} },
SupportsRawSearch = true
}; };
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.TV); caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.TV);
@ -119,7 +120,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (searchCriteria.SanitizedTvSearchString.IsNotNullOrWhiteSpace()) if (searchCriteria.SanitizedTvSearchString.IsNotNullOrWhiteSpace())
{ {
queryParams.Name = "%" + Regex.Replace(searchCriteria.SanitizedTvSearchString, @"[ -._]+", "%").Trim() + "%"; queryParams.Name = "%" + Regex.Replace(searchCriteria.SanitizedTvSearchString, "[\\W]+", "%").Trim() + "%";
} }
if (searchCriteria.TvMazeId.HasValue) if (searchCriteria.TvMazeId.HasValue)
@ -128,7 +129,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (searchCriteria.EpisodeSearchString.IsNotNullOrWhiteSpace()) if (searchCriteria.EpisodeSearchString.IsNotNullOrWhiteSpace())
{ {
queryParams.Name = "%" + Regex.Replace(searchCriteria.EpisodeSearchString, @"[ -._]+", "%").Trim() + "%"; queryParams.Name = "%" + Regex.Replace(searchCriteria.EpisodeSearchString, "[\\W]+", "%").Trim() + "%";
} }
} }
else if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace() && int.TryParse(searchCriteria.ImdbId, out var intImdb)) else if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace() && int.TryParse(searchCriteria.ImdbId, out var intImdb))
@ -137,7 +138,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (searchCriteria.EpisodeSearchString.IsNotNullOrWhiteSpace()) if (searchCriteria.EpisodeSearchString.IsNotNullOrWhiteSpace())
{ {
queryParams.Name = "%" + Regex.Replace(searchCriteria.EpisodeSearchString, @"[ -._]+", "%").Trim() + "%"; queryParams.Name = "%" + Regex.Replace(searchCriteria.EpisodeSearchString, "[\\W]+", "%").Trim() + "%";
} }
} }
@ -162,7 +163,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (searchCriteria.SanitizedSearchTerm.IsNotNullOrWhiteSpace()) if (searchCriteria.SanitizedSearchTerm.IsNotNullOrWhiteSpace())
{ {
queryParams.Name = "%" + Regex.Replace(searchCriteria.SanitizedSearchTerm, @"[ -._]+", "%").Trim() + "%"; queryParams.Name = "%" + Regex.Replace(searchCriteria.SanitizedSearchTerm, "[\\W]+", "%").Trim() + "%";
} }
pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset)); pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset));

Loading…
Cancel
Save