Managing Nested Objects and Indexing in Collections
TLDR Maxi had trouble managing nested objects and their indexing. Jason suggested using separate collections and provided an example on how to structure the data for filtering.
1
Feb 24, 2023 (9 months ago)
Maxi
06:57 PMCurrently I have the following object on the collection:
{
...
personCalendars: [{
id: '1',
calendar: [{
startDate: 1664064000,
endDate: 1664068000
}, {
startDate: 1664074000,
endDate: 1664078000
}]
}, {
id: '2',
calendar: [{
startDate: 1664064000,
endDate: 1664068000
}, {
startDate: 1664074000,
endDate: 1664078000
}]
}],
...
}
I would need to make a search that returns a document only if the calendar of a person inside the
personCalendars
nested object is not between two dates that i pass on a query (startDate
and endDate
).Is that possible with the mentioned schema? Because I think it would flatten the
personCalendars
calendars into a personCalendars.calendar.startDate
array and a personCalendars.calendar.endDate
array, mixing both dataJason
07:56 PMJason
07:57 PM{ calendar_id: 1, startDate: 1664064000, endDate: 1664068000 }
{ calendar_id: 1, startDate: 1664074000, endDate: 1664078000 }
{ calendar_id: 2, startDate: 1664064000, endDate: 1664068000 }
{ calendar_id: 2, startDate: 1664074000, endDate: 1664078000 }
Maxi
08:32 PMMaxi
08:33 PMpersons
collection, and add the calendar
filters on top of that. Isn't having two collections for one filter an issue?Feb 26, 2023 (9 months ago)
Jason
12:44 AMFeb 27, 2023 (9 months ago)
Maxi
12:38 PMMaxi
12:38 PM1
Typesense
Indexed 3011 threads (79% resolved)
Similar Threads
User-Specific Tagging and Filtering in UI
bnfd asked for the best way to create user-specific tags available on the UI. Jason suggested using personalized filters and creating a separate collection for each user's movies. The duo clarified the use of 'tags' in schemas and the refinementList widget in instantsearch. They also discussed various approaches to import and search large document collections.
Handling Field Variations in Typesense for Different Clients
Yoshi asked for a solution to handle varying contact_date fields for different clients in typesense. Jason recommended using nested fields for the short-term and mentioned future support for joining data across collections.
Discussions on Typesense, Collections, and Dynamic Fields
Tugay shares plans to use Typesense for their SaaS platform and asks about collection sizes and sharding. Jason clarifies Typesense's capabilities and shares a beta feature. They discuss using unique collections per customer and new improvements. Kishore Nallan and Gabe comment on threading and data protection respectively.
Resolving Auto-Schema and Configuration Issues in Typesense
Narayan was struggling with auto-schema and configuration issues in Typesense. With the help of Kishore Nallan, they understood and solved the problems by adding 'optional' to all nested fields. They will find a way to handle 'None'.
Discussing Support for Nested Objects in Typesense
Martin expressed the need for support for nested objects in Typesense. Kishore Nallan mentioned the possibility of flattening objects before indexing and restoring them later. An issue has been created on GitHub to track this.