supabase-community / postgrest-csharp

A C# Client library for Postgrest
https://supabase-community.github.io/postgrest-csharp/api/Postgrest.html
MIT License
118 stars 25 forks source link

Filter method throws exception with FullTextSearch criteria #22

Closed elrhomariyounes closed 3 years ago

elrhomariyounes commented 3 years ago

Bug report

Describe the bug

Hello, when trying to filter using a full text search criteria with one the operators : fts, plfts, phfts, wfts an exception is thrown by the filter method.

System.Exception: Unknown criterion type, is it of type `string`, `List`, `Dictionary<string, object>`, or `Range`?
  Stack Trace: 
    Table`1.Filter(String columnName, Operator op, Object criterion) line 129

The issue is the Filter method is not expecting the criteria to be a FullTextSearchConfig object. I solved the issue by adding a new case for it. Please check PR

To Reproduce

            var client = Client.Instance.Initialize(baseUrl, new ClientAuthorization(AuthorizationType.Open, null));

            var config = new FullTextSearchConfig("'fat' & 'cat'", "english");
            var filteredResponse = await client.Table<User>().Filter("catchphrase", Operator.FTS, config).Get();

Expected behavior

System information

-OS: [Windows 10 Pro 1909] -.Net core 3.1.x -Visual Studio 16.8 -Version of supabase-postgrest-csharp: master branch of current repo

acupofjose commented 3 years ago

Thank you!