Fixed: Don't return results with categories that were not searched

pull/374/head
Qstick 3 years ago
parent 8c326fc5c2
commit 80beea9bdb

@ -171,12 +171,27 @@ namespace NzbDrone.Core.IndexerSearch
{
var indexerReports = await searchAction(indexer);
var releases = indexerReports.Releases;
//Filter results to only those in searched categories
if (criteriaBase.Categories.Length > 0)
{
var expandedQueryCats = ((IndexerDefinition)indexer.Definition).Capabilities.Categories.ExpandTorznabQueryCategories(criteriaBase.Categories);
releases = releases.Where(result => result.Categories?.Any() != true || expandedQueryCats.Intersect(result.Categories.Select(c => c.Id)).Any()).ToList();
if (releases.Count != indexerReports.Releases.Count)
{
_logger.Trace("{0} {1} Releases which didn't contain search categories [{2}] were filtered", indexerReports.Releases.Count - releases.Count, indexer.Name, string.Join(", ", expandedQueryCats));
}
}
foreach (var query in indexerReports.Queries)
{
_eventAggregator.PublishEvent(new IndexerQueryEvent(indexer.Definition.Id, criteriaBase, query.ElapsedTime, query.StatusCode == 200, query.Releases.Count()));
}
return indexerReports.Releases;
return releases;
}
catch (Exception e)
{

@ -97,6 +97,7 @@ namespace NzbDrone.Core.Indexers
result.ForEach(c =>
{
//Set common props
c.IndexerId = Definition.Id;
c.Indexer = Definition.Name;
c.DownloadProtocol = Protocol;

Loading…
Cancel
Save