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:
Jason Dove
2022-12-03 05:47:04 -06:00
committed by GitHub
parent 25ea75b761
commit 9a30d7c7da
21 changed files with 160 additions and 66 deletions
@@ -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)