error report bug fixes (#1042)
* fix some potential null reference exceptions * searching isn't actually async * add search query breadcrumb
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Core;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using ErsatzTV.Core.Search;
|
||||
@@ -8,13 +9,16 @@ namespace ErsatzTV.Application.Maintenance;
|
||||
|
||||
public class EmptyTrashHandler : IRequestHandler<EmptyTrash, Either<BaseError, Unit>>
|
||||
{
|
||||
private readonly IClient _client;
|
||||
private readonly IMediaItemRepository _mediaItemRepository;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public EmptyTrashHandler(
|
||||
IClient client,
|
||||
IMediaItemRepository mediaItemRepository,
|
||||
ISearchIndex searchIndex)
|
||||
{
|
||||
_client = client;
|
||||
_mediaItemRepository = mediaItemRepository;
|
||||
_searchIndex = searchIndex;
|
||||
}
|
||||
@@ -39,7 +43,7 @@ public class EmptyTrashHandler : IRequestHandler<EmptyTrash, Either<BaseError, U
|
||||
|
||||
foreach (string type in types)
|
||||
{
|
||||
SearchResult result = await _searchIndex.Search($"type:{type} AND (state:FileNotFound)", 0, 0);
|
||||
SearchResult result = _searchIndex.Search(_client, $"type:{type} AND (state:FileNotFound)", 0, 0);
|
||||
ids.AddRange(result.Items.Map(i => i.Id));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,33 @@
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using ErsatzTV.Infrastructure.Search;
|
||||
|
||||
namespace ErsatzTV.Application.Search;
|
||||
|
||||
public class
|
||||
QuerySearchIndexAllItemsHandler : IRequestHandler<QuerySearchIndexAllItems, SearchResultAllItemsViewModel>
|
||||
public class QuerySearchIndexAllItemsHandler : IRequestHandler<QuerySearchIndexAllItems, SearchResultAllItemsViewModel>
|
||||
{
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public QuerySearchIndexAllItemsHandler(ISearchIndex searchIndex) => _searchIndex = searchIndex;
|
||||
public QuerySearchIndexAllItemsHandler(IClient client, ISearchIndex searchIndex)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
}
|
||||
|
||||
public async Task<SearchResultAllItemsViewModel> Handle(
|
||||
public Task<SearchResultAllItemsViewModel> Handle(
|
||||
QuerySearchIndexAllItems request,
|
||||
CancellationToken cancellationToken) =>
|
||||
new(
|
||||
await GetIds(SearchIndex.MovieType, request.Query),
|
||||
await GetIds(SearchIndex.ShowType, request.Query),
|
||||
await GetIds(SearchIndex.SeasonType, request.Query),
|
||||
await GetIds(SearchIndex.EpisodeType, request.Query),
|
||||
await GetIds(SearchIndex.ArtistType, request.Query),
|
||||
await GetIds(SearchIndex.MusicVideoType, request.Query),
|
||||
await GetIds(SearchIndex.OtherVideoType, request.Query),
|
||||
await GetIds(SearchIndex.SongType, request.Query));
|
||||
new SearchResultAllItemsViewModel(
|
||||
GetIds(SearchIndex.MovieType, request.Query),
|
||||
GetIds(SearchIndex.ShowType, request.Query),
|
||||
GetIds(SearchIndex.SeasonType, request.Query),
|
||||
GetIds(SearchIndex.EpisodeType, request.Query),
|
||||
GetIds(SearchIndex.ArtistType, request.Query),
|
||||
GetIds(SearchIndex.MusicVideoType, request.Query),
|
||||
GetIds(SearchIndex.OtherVideoType, request.Query),
|
||||
GetIds(SearchIndex.SongType, request.Query)).AsTask();
|
||||
|
||||
private Task<List<int>> GetIds(string type, string query) =>
|
||||
_searchIndex.Search($"type:{type} AND ({query})", 0, 0)
|
||||
.Map(result => result.Items.Map(i => i.Id).ToList());
|
||||
private List<int> GetIds(string type, string query) =>
|
||||
_searchIndex.Search(_client, $"type:{type} AND ({query})", 0, 0).Items.Map(i => i.Id).ToList();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using ErsatzTV.Core.Search;
|
||||
@@ -6,15 +7,15 @@ using static ErsatzTV.Application.MediaCards.Mapper;
|
||||
|
||||
namespace ErsatzTV.Application.Search;
|
||||
|
||||
public class
|
||||
QuerySearchIndexArtistsHandler : IRequestHandler<QuerySearchIndexArtists, ArtistCardResultsViewModel
|
||||
>
|
||||
public class QuerySearchIndexArtistsHandler : IRequestHandler<QuerySearchIndexArtists, ArtistCardResultsViewModel>
|
||||
{
|
||||
private readonly IArtistRepository _artistRepository;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public QuerySearchIndexArtistsHandler(ISearchIndex searchIndex, IArtistRepository artistRepository)
|
||||
public QuerySearchIndexArtistsHandler(IClient client, ISearchIndex searchIndex, IArtistRepository artistRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_artistRepository = artistRepository;
|
||||
}
|
||||
@@ -23,7 +24,8 @@ public class
|
||||
QuerySearchIndexArtists request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Extensions;
|
||||
using ErsatzTV.Core.Interfaces.Emby;
|
||||
@@ -24,10 +25,12 @@ public class
|
||||
private readonly IJellyfinPathReplacementService _jellyfinPathReplacementService;
|
||||
private readonly IMediaSourceRepository _mediaSourceRepository;
|
||||
private readonly IPlexPathReplacementService _plexPathReplacementService;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
private readonly ITelevisionRepository _televisionRepository;
|
||||
|
||||
public QuerySearchIndexEpisodesHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
ITelevisionRepository televisionRepository,
|
||||
IMediaSourceRepository mediaSourceRepository,
|
||||
@@ -37,6 +40,7 @@ public class
|
||||
IFallbackMetadataProvider fallbackMetadataProvider,
|
||||
IDbContextFactory<TvContext> dbContextFactory)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_televisionRepository = televisionRepository;
|
||||
_mediaSourceRepository = mediaSourceRepository;
|
||||
@@ -51,7 +55,8 @@ public class
|
||||
QuerySearchIndexEpisodes request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
@@ -11,13 +12,16 @@ public class QuerySearchIndexMoviesHandler : IRequestHandler<QuerySearchIndexMov
|
||||
{
|
||||
private readonly IMediaSourceRepository _mediaSourceRepository;
|
||||
private readonly IMovieRepository _movieRepository;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public QuerySearchIndexMoviesHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
IMovieRepository movieRepository,
|
||||
IMediaSourceRepository mediaSourceRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_movieRepository = movieRepository;
|
||||
_mediaSourceRepository = mediaSourceRepository;
|
||||
@@ -27,7 +31,8 @@ public class QuerySearchIndexMoviesHandler : IRequestHandler<QuerySearchIndexMov
|
||||
QuerySearchIndexMovies request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Extensions;
|
||||
using ErsatzTV.Core.Interfaces.Emby;
|
||||
@@ -18,15 +19,18 @@ public class
|
||||
private readonly IJellyfinPathReplacementService _jellyfinPathReplacementService;
|
||||
private readonly IMusicVideoRepository _musicVideoRepository;
|
||||
private readonly IPlexPathReplacementService _plexPathReplacementService;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public QuerySearchIndexMusicVideosHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
IMusicVideoRepository musicVideoRepository,
|
||||
IPlexPathReplacementService plexPathReplacementService,
|
||||
IJellyfinPathReplacementService jellyfinPathReplacementService,
|
||||
IEmbyPathReplacementService embyPathReplacementService)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_musicVideoRepository = musicVideoRepository;
|
||||
_plexPathReplacementService = plexPathReplacementService;
|
||||
@@ -38,7 +42,8 @@ public class
|
||||
QuerySearchIndexMusicVideos request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using ErsatzTV.Core.Search;
|
||||
@@ -11,10 +12,15 @@ public class
|
||||
OtherVideoCardResultsViewModel>
|
||||
{
|
||||
private readonly IOtherVideoRepository _otherVideoRepository;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public QuerySearchIndexOtherVideosHandler(ISearchIndex searchIndex, IOtherVideoRepository otherVideoRepository)
|
||||
public QuerySearchIndexOtherVideosHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
IOtherVideoRepository otherVideoRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_otherVideoRepository = otherVideoRepository;
|
||||
}
|
||||
@@ -23,7 +29,8 @@ public class
|
||||
QuerySearchIndexOtherVideos request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
@@ -11,14 +12,17 @@ public class
|
||||
QuerySearchIndexSeasonsHandler : IRequestHandler<QuerySearchIndexSeasons, TelevisionSeasonCardResultsViewModel>
|
||||
{
|
||||
private readonly IMediaSourceRepository _mediaSourceRepository;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
private readonly ITelevisionRepository _televisionRepository;
|
||||
|
||||
public QuerySearchIndexSeasonsHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
ITelevisionRepository televisionRepository,
|
||||
IMediaSourceRepository mediaSourceRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_televisionRepository = televisionRepository;
|
||||
_mediaSourceRepository = mediaSourceRepository;
|
||||
@@ -28,7 +32,8 @@ public class
|
||||
QuerySearchIndexSeasons request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
@@ -11,14 +12,17 @@ public class
|
||||
QuerySearchIndexShowsHandler : IRequestHandler<QuerySearchIndexShows, TelevisionShowCardResultsViewModel>
|
||||
{
|
||||
private readonly IMediaSourceRepository _mediaSourceRepository;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
private readonly ITelevisionRepository _televisionRepository;
|
||||
|
||||
public QuerySearchIndexShowsHandler(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
ITelevisionRepository televisionRepository,
|
||||
IMediaSourceRepository mediaSourceRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_televisionRepository = televisionRepository;
|
||||
_mediaSourceRepository = mediaSourceRepository;
|
||||
@@ -28,7 +32,8 @@ public class
|
||||
QuerySearchIndexShows request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Application.MediaCards;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
using ErsatzTV.Core.Search;
|
||||
@@ -6,15 +7,15 @@ using static ErsatzTV.Application.MediaCards.Mapper;
|
||||
|
||||
namespace ErsatzTV.Application.Search;
|
||||
|
||||
public class
|
||||
QuerySearchIndexSongsHandler : IRequestHandler<QuerySearchIndexSongs,
|
||||
SongCardResultsViewModel>
|
||||
public class QuerySearchIndexSongsHandler : IRequestHandler<QuerySearchIndexSongs, SongCardResultsViewModel>
|
||||
{
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
private readonly ISongRepository _songRepository;
|
||||
|
||||
public QuerySearchIndexSongsHandler(ISearchIndex searchIndex, ISongRepository songRepository)
|
||||
public QuerySearchIndexSongsHandler(IClient client, ISearchIndex searchIndex, ISongRepository songRepository)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_songRepository = songRepository;
|
||||
}
|
||||
@@ -23,7 +24,8 @@ public class
|
||||
QuerySearchIndexSongs request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
SearchResult searchResult = await _searchIndex.Search(
|
||||
SearchResult searchResult = _searchIndex.Search(
|
||||
_client,
|
||||
request.Query,
|
||||
(request.PageNumber - 1) * request.PageSize,
|
||||
request.PageSize);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Bugsnag;
|
||||
using Dapper;
|
||||
using Destructurama;
|
||||
using ErsatzTV.Core.Domain;
|
||||
@@ -152,7 +153,7 @@ public class ScheduleIntegrationTests
|
||||
|
||||
var builder = new PlayoutBuilder(
|
||||
new ConfigElementRepository(factory),
|
||||
new MediaCollectionRepository(new Mock<ISearchIndex>().Object, factory),
|
||||
new MediaCollectionRepository(new Mock<IClient>().Object, new Mock<ISearchIndex>().Object, factory),
|
||||
new TelevisionRepository(factory),
|
||||
new ArtistRepository(factory),
|
||||
new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>().Object,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.Core.Domain;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Metadata;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Repositories.Caching;
|
||||
@@ -23,6 +24,6 @@ public interface ISearchIndex : IDisposable
|
||||
List<MediaItem> items);
|
||||
|
||||
Task<Unit> RemoveItems(List<int> ids);
|
||||
Task<SearchResult> Search(string query, int skip, int limit, string searchField = "");
|
||||
SearchResult Search(IClient client, string query, int skip, int limit, string searchField = "");
|
||||
void Commit();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dapper;
|
||||
using Bugsnag;
|
||||
using Dapper;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Search;
|
||||
@@ -13,12 +14,15 @@ namespace ErsatzTV.Infrastructure.Data.Repositories;
|
||||
public class MediaCollectionRepository : IMediaCollectionRepository
|
||||
{
|
||||
private readonly IDbContextFactory<TvContext> _dbContextFactory;
|
||||
private readonly IClient _client;
|
||||
private readonly ISearchIndex _searchIndex;
|
||||
|
||||
public MediaCollectionRepository(
|
||||
IClient client,
|
||||
ISearchIndex searchIndex,
|
||||
IDbContextFactory<TvContext> dbContextFactory)
|
||||
{
|
||||
_client = client;
|
||||
_searchIndex = searchIndex;
|
||||
_dbContextFactory = dbContextFactory;
|
||||
}
|
||||
@@ -96,7 +100,7 @@ public class MediaCollectionRepository : IMediaCollectionRepository
|
||||
|
||||
foreach (SmartCollection collection in maybeCollection)
|
||||
{
|
||||
SearchResult searchResults = await _searchIndex.Search(collection.Query, 0, 0);
|
||||
SearchResult searchResults = _searchIndex.Search(_client, collection.Query, 0, 0);
|
||||
|
||||
var movieIds = searchResults.Items
|
||||
.Filter(i => i.Type == SearchIndex.MovieType)
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PlexServerApiClient : IPlexServerApiClient
|
||||
{
|
||||
return jsonService
|
||||
.GetLibrarySectionContents(library.Key, skip, pageSize, token.AuthToken)
|
||||
.Map(r => r.MediaContainer.Metadata)
|
||||
.Map(r => r.MediaContainer.Metadata ?? new List<PlexMetadataResponse>())
|
||||
.Map(list => list.Map(metadata => ProjectToShow(metadata, library.MediaSourceId)));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Globalization;
|
||||
using Bugsnag;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Metadata;
|
||||
@@ -173,11 +174,21 @@ public sealed class SearchIndex : ISearchIndex
|
||||
return Task.FromResult(Unit.Default);
|
||||
}
|
||||
|
||||
public Task<SearchResult> Search(string searchQuery, int skip, int limit, string searchField = "")
|
||||
public SearchResult Search(IClient client, string searchQuery, int skip, int limit, string searchField = "")
|
||||
{
|
||||
var metadata = new Dictionary<string, string>
|
||||
{
|
||||
{ "searchQuery", searchQuery },
|
||||
{ "skip", skip.ToString() },
|
||||
{ "limit", limit.ToString() },
|
||||
{ "searchField", searchField }
|
||||
};
|
||||
|
||||
client.Breadcrumbs.Leave("SearchIndex.Search", BreadcrumbType.State, metadata);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(searchQuery.Replace("*", string.Empty).Replace("?", string.Empty)))
|
||||
{
|
||||
return new SearchResult(new List<SearchItem>(), 0).AsTask();
|
||||
return new SearchResult(new List<SearchItem>(), 0);
|
||||
}
|
||||
|
||||
using DirectoryReader reader = _writer.GetReader(true);
|
||||
@@ -214,7 +225,7 @@ public sealed class SearchIndex : ISearchIndex
|
||||
searchResult.PageMap = GetSearchPageMap(searcher, query, filter, sort, limit);
|
||||
}
|
||||
|
||||
return searchResult.AsTask();
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
public void Commit() => _writer.Commit();
|
||||
|
||||
@@ -109,7 +109,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteChannel(channel.Id), _cts.Token);
|
||||
await _table.ReloadServerData();
|
||||
if (_table != null)
|
||||
{
|
||||
await _table.ReloadServerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteCollection(collection.Id), _cts.Token);
|
||||
await _collectionsTable.ReloadServerData();
|
||||
if (_collectionsTable != null)
|
||||
{
|
||||
await _collectionsTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +187,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteMultiCollection(collection.Id), _cts.Token);
|
||||
await _multiCollectionsTable.ReloadServerData();
|
||||
if (_multiCollectionsTable != null)
|
||||
{
|
||||
await _multiCollectionsTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +204,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteSmartCollection(collection.Id), _cts.Token);
|
||||
await _smartCollectionsTable.ReloadServerData();
|
||||
if (_smartCollectionsTable != null)
|
||||
{
|
||||
await _smartCollectionsTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteFillerPreset(fillerPreset.Id), _cts.Token);
|
||||
await _fillerPresetsTable.ReloadServerData();
|
||||
if (_fillerPresetsTable != null)
|
||||
{
|
||||
await _fillerPresetsTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
if (_showFiller != value)
|
||||
{
|
||||
_showFiller = value;
|
||||
if (_selectedPlayoutId != null)
|
||||
if (_detailTable != null && _selectedPlayoutId != null)
|
||||
{
|
||||
_detailTable.ReloadServerData();
|
||||
}
|
||||
@@ -142,7 +142,10 @@
|
||||
private async Task PlayoutSelected(PlayoutNameViewModel playout)
|
||||
{
|
||||
_selectedPlayoutId = playout.PlayoutId;
|
||||
await _detailTable.ReloadServerData();
|
||||
if (_detailTable != null)
|
||||
{
|
||||
await _detailTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeletePlayout(PlayoutNameViewModel playout)
|
||||
@@ -155,7 +158,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeletePlayout(playout.PlayoutId), _cts.Token);
|
||||
await _table.ReloadServerData();
|
||||
if (_table != null)
|
||||
{
|
||||
await _table.ReloadServerData();
|
||||
}
|
||||
if (_selectedPlayoutId == playout.PlayoutId)
|
||||
{
|
||||
_selectedPlayoutId = null;
|
||||
@@ -166,7 +172,10 @@
|
||||
private async Task ResetPlayout(PlayoutNameViewModel playout)
|
||||
{
|
||||
await _mediator.Send(new BuildPlayout(playout.PlayoutId, PlayoutBuildMode.Reset), _cts.Token);
|
||||
await _table.ReloadServerData();
|
||||
if (_table != null)
|
||||
{
|
||||
await _table.ReloadServerData();
|
||||
}
|
||||
if (_selectedPlayoutId == playout.PlayoutId)
|
||||
{
|
||||
await PlayoutSelected(playout);
|
||||
@@ -187,7 +196,10 @@
|
||||
IDialogReference dialog = await _dialog.ShowAsync<SchedulePlayoutReset>("Schedule Playout Reset", parameters, options);
|
||||
await dialog.Result;
|
||||
|
||||
await _table.ReloadServerData();
|
||||
if (_table != null)
|
||||
{
|
||||
await _table.ReloadServerData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<TableData<PlayoutNameViewModel>> ServerReload(TableState state)
|
||||
|
||||
@@ -113,7 +113,10 @@
|
||||
private async Task ScheduleSelected(ProgramScheduleViewModel schedule)
|
||||
{
|
||||
_selectedSchedule = schedule;
|
||||
await _detailTable.ReloadServerData();
|
||||
if (_selectedSchedule != null && _detailTable != null)
|
||||
{
|
||||
await _detailTable.ReloadServerData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteSchedule(ProgramScheduleViewModel programSchedule)
|
||||
@@ -126,7 +129,10 @@
|
||||
if (!result.Cancelled)
|
||||
{
|
||||
await _mediator.Send(new DeleteProgramSchedule(programSchedule.Id), _cts.Token);
|
||||
await _table.ReloadServerData();
|
||||
if (_table != null)
|
||||
{
|
||||
await _table.ReloadServerData();
|
||||
}
|
||||
if (_selectedSchedule == programSchedule)
|
||||
{
|
||||
_selectedSchedule = null;
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
InvokeAsync(async () =>
|
||||
{
|
||||
StateHasChanged();
|
||||
if (!_locker.IsTraktLocked())
|
||||
if (_traktListsTable != null && !_locker.IsTraktLocked())
|
||||
{
|
||||
await _traktListsTable.ReloadServerData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user