* clean up genre, tag, studio orphans * enforce foreign keys at connection level * wip * fix fragment scroll offset * fix see all link for music videos * add fake artist metadata * not null artist id * add artist scanning * remove improperly named music videos * code cleanup * add artists to search results and collections * clean up music video metadata / artist * add artist view * show music videos on artist page * add music video artwork placeholder
35 lines
1.5 KiB
C#
35 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using ErsatzTV.Core.Interfaces.Search;
|
|
using LanguageExt;
|
|
using MediatR;
|
|
|
|
namespace ErsatzTV.Application.Search.Queries
|
|
{
|
|
public class
|
|
QuerySearchIndexAllItemsHandler : IRequestHandler<QuerySearchIndexAllItems, SearchResultAllItemsViewModel>
|
|
{
|
|
private readonly ISearchIndex _searchIndex;
|
|
|
|
public QuerySearchIndexAllItemsHandler(ISearchIndex searchIndex) => _searchIndex = searchIndex;
|
|
|
|
public async Task<SearchResultAllItemsViewModel> Handle(
|
|
QuerySearchIndexAllItems request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
List<int> movieIds = await _searchIndex.Search($"type:movie AND ({request.Query})", 0, 0)
|
|
.Map(result => result.Items.Map(i => i.Id).ToList());
|
|
List<int> showIds = await _searchIndex.Search($"type:show AND ({request.Query})", 0, 0)
|
|
.Map(result => result.Items.Map(i => i.Id).ToList());
|
|
List<int> artistIds = await _searchIndex.Search($"type:artist AND ({request.Query})", 0, 0)
|
|
.Map(result => result.Items.Map(i => i.Id).ToList());
|
|
List<int> musicVideoIds = await _searchIndex.Search($"type:music_video AND ({request.Query})", 0, 0)
|
|
.Map(result => result.Items.Map(i => i.Id).ToList());
|
|
|
|
return new SearchResultAllItemsViewModel(movieIds, showIds, artistIds, musicVideoIds);
|
|
}
|
|
}
|
|
}
|