Handling `string | null` Fields in Schema
TLDR gab asked about handling string | null
fields in schemas. Kishore Nallan suggested they could be marked as optional, so either the field doesn't exist or the value can be null.
Powered by Struct AI
5
31mo
Solved
Jul 09, 2021 (31 months ago)
gab
gab
03:55 PMHi, how should be handled fields that can be
Shall I create a schema with
Or shall I just drop my empty fields maybe?
Thanks for insight
string | null
?Shall I create a schema with
string
type and then play with the dirty_values
flag to handle null values?Or shall I just drop my empty fields maybe?
Thanks for insight
Kishore Nallan
Kishore Nallan
03:56 PMYou can mark field as
optional: true
in the schema03:56
Kishore Nallan
03:56 PMThis way, either that field need not exist in the document or its value can be
null
(the latter feature available in the RC)gab
gab
03:57 PMUps sorry to have badly read the documentation, it makes sense, thanks!
Kishore Nallan
Kishore Nallan
03:57 PMNo worries.
Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
Indexed 3005 threads (79% resolved)
Similar Threads
Dealing with Nullable Field in Database Schema
Andrew asked how to represent a nullable field in schema. Jason advised setting the field as `optional: true`.
3
13mo
Solved
Resolving NULL Values Issue in Typesense Project
andy thanked Kishore for helping with their typesense project. They shared a problem regarding NULL values that they resolved. Kishore Nallan suggested marking the field as optional for addressing such issues.
2
12mo
Handling Null Fields in Schema
Ivan reported a bug regarding null fields in the schema. Kishore Nallan confirmed it as a bug, asked to file a Github report, and mentioned it was fixed in version 0.25.0.rc25.
10
7mo
Solved