mirror of https://github.com/Jackett/Jackett
core: show invalid releases in the interactive search (#15243)
This commit is contained in:
parent
3878873163
commit
f94d2721cc
|
@ -470,6 +470,10 @@ namespace Jackett.Common.Indexers
|
||||||
{
|
{
|
||||||
// Ignore these categories as they'll cause hell with the matcher
|
// Ignore these categories as they'll cause hell with the matcher
|
||||||
// TV Special, DVD Special, BD Special
|
// TV Special, DVD Special, BD Special
|
||||||
|
if (groupName == "TV Special" || groupName == "DVD Special" || groupName == "BD Special")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (groupName == "TV Series" || groupName == "OVA" || groupName == "ONA")
|
if (groupName == "TV Series" || groupName == "OVA" || groupName == "ONA")
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace Jackett.Common.Indexers
|
||||||
|
|
||||||
protected virtual IEnumerable<ReleaseInfo> FilterResults(TorznabQuery query, IEnumerable<ReleaseInfo> results)
|
protected virtual IEnumerable<ReleaseInfo> FilterResults(TorznabQuery query, IEnumerable<ReleaseInfo> results)
|
||||||
{
|
{
|
||||||
var filteredResults = results.Where(IsValidRelease).ToList();
|
var filteredResults = results.Where(r => IsValidRelease(r, query.InteractiveSearch)).ToList();
|
||||||
|
|
||||||
// filter results with wrong categories
|
// filter results with wrong categories
|
||||||
if (query.Categories.Length > 0)
|
if (query.Categories.Length > 0)
|
||||||
|
@ -237,7 +237,7 @@ namespace Jackett.Common.Indexers
|
||||||
return fixedResults;
|
return fixedResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsValidRelease(ReleaseInfo release)
|
protected virtual bool IsValidRelease(ReleaseInfo release, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
if (release.Title.IsNullOrWhiteSpace())
|
if (release.Title.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
|
@ -246,6 +246,12 @@ namespace Jackett.Common.Indexers
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interactiveSearch)
|
||||||
|
{
|
||||||
|
// Show releases with issues in the interactive search
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (release.Size == null)
|
if (release.Size == null)
|
||||||
{
|
{
|
||||||
logger.Warn("[{0}] Invalid Release: '{1}'. No size provided.", Id, release.Details);
|
logger.Warn("[{0}] Invalid Release: '{1}'. No size provided.", Id, release.Details);
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Jackett.Common.Models
|
||||||
private static readonly Regex _StandardizeDashesRegex = new Regex(@"\p{Pd}+", RegexOptions.Compiled);
|
private static readonly Regex _StandardizeDashesRegex = new Regex(@"\p{Pd}+", RegexOptions.Compiled);
|
||||||
private static readonly Regex _StandardizeSingleQuotesRegex = new Regex(@"[\u0060\u00B4\u2018\u2019]", RegexOptions.Compiled);
|
private static readonly Regex _StandardizeSingleQuotesRegex = new Regex(@"[\u0060\u00B4\u2018\u2019]", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public bool InteractiveSearch { get; set; }
|
||||||
public string QueryType { get; set; }
|
public string QueryType { get; set; }
|
||||||
public int[] Categories { get; set; }
|
public int[] Categories { get; set; }
|
||||||
public int Extended { get; set; }
|
public int Extended { get; set; }
|
||||||
|
@ -167,6 +168,7 @@ namespace Jackett.Common.Models
|
||||||
{
|
{
|
||||||
var ret = new TorznabQuery
|
var ret = new TorznabQuery
|
||||||
{
|
{
|
||||||
|
InteractiveSearch = InteractiveSearch,
|
||||||
QueryType = QueryType,
|
QueryType = QueryType,
|
||||||
Extended = Extended,
|
Extended = Extended,
|
||||||
ApiKey = ApiKey,
|
ApiKey = ApiKey,
|
||||||
|
@ -212,7 +214,7 @@ namespace Jackett.Common.Models
|
||||||
|
|
||||||
// Some trackers don't support AND logic for search terms resulting in unwanted results.
|
// Some trackers don't support AND logic for search terms resulting in unwanted results.
|
||||||
// Using this method we can AND filter it within jackett.
|
// Using this method we can AND filter it within jackett.
|
||||||
// With limit we can limit the amount of characters which should be compared (use it if a tracker doesn't return the full title).
|
// With "limit" we can limit the amount of characters which should be compared (use it if a tracker doesn't return the full title).
|
||||||
public bool MatchQueryStringAND(string title, int? limit = null, string queryStringOverride = null)
|
public bool MatchQueryStringAND(string title, int? limit = null, string queryStringOverride = null)
|
||||||
{
|
{
|
||||||
var commonWords = new[] { "and", "the", "an" };
|
var commonWords = new[] { "and", "the", "an" };
|
||||||
|
|
|
@ -236,8 +236,8 @@ namespace Jackett.Server.Controllers
|
||||||
|
|
||||||
var manualResult = new ManualSearchResult();
|
var manualResult = new ManualSearchResult();
|
||||||
|
|
||||||
var trackers = CurrentIndexer is BaseMetaIndexer
|
var trackers = CurrentIndexer is BaseMetaIndexer metaIndexer
|
||||||
? (CurrentIndexer as BaseMetaIndexer).ValidIndexers
|
? metaIndexer.ValidIndexers
|
||||||
: (new[] { CurrentIndexer });
|
: (new[] { CurrentIndexer });
|
||||||
|
|
||||||
// Filter current trackers list on Tracker query parameter if available
|
// Filter current trackers list on Tracker query parameter if available
|
||||||
|
@ -245,8 +245,11 @@ namespace Jackett.Server.Controllers
|
||||||
trackers = trackers.Where(t => request.Tracker.Contains(t.Id));
|
trackers = trackers.Where(t => request.Tracker.Contains(t.Id));
|
||||||
trackers = trackers.Where(t => t.CanHandleQuery(CurrentQuery));
|
trackers = trackers.Where(t => t.CanHandleQuery(CurrentQuery));
|
||||||
|
|
||||||
|
CurrentQuery.InteractiveSearch = true;
|
||||||
|
|
||||||
var isMetaIndexer = request.Tracker == null || request.Tracker.Length > 1;
|
var isMetaIndexer = request.Tracker == null || request.Tracker.Length > 1;
|
||||||
var tasks = trackers.ToList().Select(t => t.ResultsForQuery(CurrentQuery, isMetaIndexer)).ToList();
|
var tasks = trackers.ToList().Select(t => t.ResultsForQuery(CurrentQuery, isMetaIndexer)).ToList();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var aggregateTask = Task.WhenAll(tasks);
|
var aggregateTask = Task.WhenAll(tasks);
|
||||||
|
|
Loading…
Reference in New Issue