typesense / typesense-dart

Dart client for Typesense
https://typesense.org/docs
Apache License 2.0
71 stars 16 forks source link

Add ability to specify locale when creating a schema #120

Closed keith555 closed 2 years ago

keith555 commented 2 years ago

I can assign a locale to a schema field using the API directly, like this

     curl "http://localhost:8108/collections" \
       -X POST \
       -H "Content-Type: application/json" \
       -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
       -d '{
         "name": "english_thai",
         "fields": [
          {"name": "english", "type": "string" },
          {"name": "thai", "type": "string", "locale": "th" }
         ],
         "default_sorting_field": "num_employees"
       }'

I can't find an equivalent way to specify locale using the dart client.

happy-san commented 2 years ago

Hi @keith555 I've just committed code that makes 2.17.0 as the mininum dart SDK version. I can add this field, just wanted to confirm if you can match this constraint. If not I can revert this and push your request first.

keith555 commented 2 years ago

2.17.0 is fine. Thanks a lot for your quick response.

happy-san commented 2 years ago

Hi @keith555 Could you check out this branch? https://github.com/happy-san/typesense-dart/blob/chores/lib/src/models/field.dart

There are some breaking changes to the models to support the v0.23.0 Typsense. I hope that's acceptable.

keith555 commented 2 years ago

That seems to be working now. Thanks a lot for your speedy help.