Returned documents as objects, for metadata #512
Replies: 1 comment 1 reply
-
@Pierstoval Really thank you, I appreciate your feedback and time to go through my slides 🙏 . We had in the past discussion before SEAL about such a general That is also kind of planned that on top of SEAL additonal packages should provide that Typesafety Objects. So the target is that in future you can create your own Search Document class specially optimized for your usecase and and your own properties. Similar how a
I kind of like your input and thinking here. But would definitly see this as part of #81 to have that logic not inside the core of SEAL instead of an own package. But I think we are also kind of limited in SEAL because of the wide range of supported Engines to a very strict schema which need to match, not all engine support nested objects and so SEAL in some cases need to flatten it and the strict schema is required to unflatten it again and unknown fields so thrown away. So like in for database migration for real blue green deployment also for SEAL you should add the new field, deploy it and later if you migrated all data to the new field remove it. I will link your points inside the #81 as I think it some great feedback and things which we could keep in mind for that part. |
Beta Was this translation helpful? Give feedback.
-
Hello, I've only seen your slides (wasn't there to see the show unfortunately), and this looks extremely promising!
In your setup, you show that returned documents are usually arrays.
I wondered if you had thought about using a few layers here, to have an internal class, like
SearchResult
, and each item in it would be an instance of aSearchDocument
or whatever naming suits better, which would contain an internalprivate array $data
property that would contain the actual data.The role of this layer would allow 3 things IMO:
null
means the provider didn't give the information (so either change method or change provider), and non-null means you can interact with your index more fluently.SearchDocument
class might contain anobject
version of the data: it would drastically ease the integration of a data mapper, deserializer, denormalizer, making both accesses possible, and data mappers wouldn't even need to be strict about fields, so you could always have access to both the array version and the object one, mostly to allow the provider to return "old data" that isn't in sync with "new mapping": this way, userland can detect that and act accordingly: update the object with new kind of data, trigger deprecations, drop indices, etc.WDYT?
Beta Was this translation helpful? Give feedback.
All reactions