Files
ersatztv/ErsatzTV.Infrastructure.Tests/Search/SearchQueryParserTests.cs
T
Jason DoveandGitHub 974020a98f optimize searching for shows, seasons and movies (#2768)
* load search logging level on startup

* optimize searching for shows, seasons and movies

* use season metadata directly
2026-01-12 19:42:49 -06:00

30 lines
1.0 KiB
C#

using ErsatzTV.Core.Search;
using ErsatzTV.Infrastructure.Search;
using Lucene.Net.Search;
using Microsoft.Extensions.Logging;
using NSubstitute;
using NUnit.Framework;
using Shouldly;
namespace ErsatzTV.Infrastructure.Tests.Search;
public class SearchQueryParserTests
{
[TestFixture]
public class ParseQuery
{
[TestCase("actor:\"Will Smith\"", "actor:\"will smith\"")]
[TestCase("tag:\"Will Smith\"", "tag:\"will smith\"")]
[TestCase("library_id:4", "library_id:4")]
[TestCase("content_rating:\"TV-14\"", "content_rating:TV-14")]
public async Task Test(string input, string expected)
{
ISmartCollectionCache smartCollectionCache = Substitute.For<ISmartCollectionCache>();
var parser = new SearchQueryParser(smartCollectionCache, Substitute.For<ILogger<SearchQueryParser>>());
Query result = await parser.ParseQuery(input, null, [LuceneSearchIndex.TitleField], CancellationToken.None);
result.ToString().ShouldBe(expected);
}
}
}