Handling Array of Objects for TypeSense
TLDR notyalc asked how to handle arrays in TypeSense; Andrew recommended having the data in TypeSense twice: flattened and non-flattened. The non-flattened version is displayed in the UI. Jason confirmed they'll document this approach and add future support for nested objects.
2
1
1
Dec 15, 2021 (25 months ago)
notyalc
05:37 PMHow should I go about shaping an array of objects for TypeSense? If I understand correctly, that data need to be flattened but Iโm not sure how to reconstruct that back to itโs original shape for showing in our product UI.
notyalc
05:40 PMconst data = {
userName: 'Clayton Ray',
userLocation: 'Tampa, FL',
schools: [
{ id: 'uuid.v4()', name: 'Harvard', grad: 1990 },
{ id: 'uuid.v4()', name: 'Yale', grad: 1995 },
]
}
Andrew
06:24 PMYou can submit arrays of objects to typesense, as long as you dont want them indexed. So we have the data in typesense twice: flattened and non-flattened. We search in the flattened data but the UI displays the non-flattened. As I understand it the non-indexed data is stored on disk, so doesnt affect RAM requirements, just disk
1
notyalc
06:29 PMJason
07:01 PMnotyalc
07:02 PMnotyalc
07:02 PMJason
07:03 PMJason
07:04 PMnotyalc
07:06 PMJason
07:06 PM1
notyalc
07:06 PM1
notyalc
07:07 PMAndrew
07:41 PM1
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Typesense Bug Fix with `canceled_at` Field and Upgrade Concerns
Mateo reported an issue regarding the treatment of an optional field by Typesense which was confirmed a bug by Jason. After trying an upgrade, an error arose. Jason explained the bug was due to a recent change and proceeded to downgrade their version. Future upgrade protocols were discussed.
Trouble in Implementing Deeply Nested Search
Anirudh is struggling to implement a two-level nested search. Jason asked for some specific examples to study the issue. Anirudh provided some material, realizing that adding top fields helped but might over-index. Jason then suggested reporting this issue on GitHub.
Issue with `included_fields` Command in Typesense
SamHendley encountered an issue with the `included_fields` command in Typesense versions 0.23.0 and 0.24.0.rc17. Jason helped identify it as a bug in the 0.24.X version, which was later addressed in release 0.24.0.rcn19.
Resolving Multilingual Search Function in Typesense Software
Bill is having difficulty with multilingual search functionality in Typesense software. Developer Kishore Nallan suggested setting a language locale and provided a demo build. The build solution had some issues, and after multiple rounds of software updates and troubleshooting, the problem still persists.
Upgrading Typesense to Solve Syntax Error
Ken encountered an issue with Typesense search enhancements on their site and Jason suggested an upgrade. They also discussed the possible downtime and finalized the process.