Skip to content

Commit

Permalink
Merge pull request #2620 from MediaBrowser/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
LukePulverenti authored May 6, 2017
2 parents b36c6b1 + 0b4d2b0 commit 5bdfebd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Emby.Server.Implementations/Library/SearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private Task<IEnumerable<SearchHintInfo>> GetSearchHints(SearchQuery query, User

var hints = new List<Tuple<BaseItem, string, int>>();

var excludeItemTypes = new List<string>();
var excludeItemTypes = query.ExcludeItemTypes.ToList();
var includeItemTypes = (query.IncludeItemTypes ?? new string[] { }).ToList();

excludeItemTypes.Add(typeof(Year).Name);
Expand Down Expand Up @@ -174,7 +174,8 @@ private Task<IEnumerable<SearchHintInfo>> GetSearchHints(SearchQuery query, User
IsMovie = query.IsMovie,
IsNews = query.IsNews,
IsSeries = query.IsSeries,
IsSports = query.IsSports
IsSports = query.IsSports,
MediaTypes = query.MediaTypes
});

// Add search hints based on item name
Expand Down
8 changes: 8 additions & 0 deletions MediaBrowser.Api/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public class GetSearchHints : IReturn<SearchHintResult>
[ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string IncludeItemTypes { get; set; }

[ApiMember(Name = "ExcludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string ExcludeItemTypes { get; set; }

[ApiMember(Name = "MediaTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string MediaTypes { get; set; }

public string ParentId { get; set; }

[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
Expand Down Expand Up @@ -154,6 +160,8 @@ private async Task<SearchHintResult> GetSearchHintsAsync(GetSearchHints request)
StartIndex = request.StartIndex,
UserId = request.UserId,
IncludeItemTypes = (request.IncludeItemTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
ExcludeItemTypes = (request.ExcludeItemTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
MediaTypes = (request.MediaTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
ParentId = request.ParentId,

IsKids = request.IsKids,
Expand Down
4 changes: 4 additions & 0 deletions MediaBrowser.Model/Search/SearchQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public class SearchQuery
public bool IncludeStudios { get; set; }
public bool IncludeArtists { get; set; }

public string[] MediaTypes { get; set; }
public string[] IncludeItemTypes { get; set; }
public string[] ExcludeItemTypes { get; set; }
public string ParentId { get; set; }

public bool? IsMovie { get; set; }
Expand All @@ -54,7 +56,9 @@ public SearchQuery()
IncludePeople = true;
IncludeStudios = true;

MediaTypes = new string[] { };
IncludeItemTypes = new string[] { };
ExcludeItemTypes = new string[] { };
}
}
}

0 comments on commit 5bdfebd

Please sign in to comment.