using Microsoft.EntityFrameworkCore;
using System.Text;

namespace JSMR.Infrastructure.Data.Repositories.VoiceWorks;

public class MySqlVoiceWorkFullTextSearch : IVoiceWorkFullTextSearch
{
    public IQueryable<int> MatchingIds(AppDbContext context, string searchText) =>
        context.VoiceWorkSearches
            .Where(v => EF.Functions.Match(v.SearchText, MySqlBooleanQuery.Normalize(searchText), MySqlMatchSearchMode.Boolean) > 0)
            .Select(v => v.VoiceWorkId);
}