-
Notifications
You must be signed in to change notification settings - Fork 43
feat: add supports for JsonStreamer on indexation #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add supports for JsonStreamer on indexation #218
Conversation
damienalexandre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this nice addition 👍
Would there be a way to make it less "intrusive", meaning having less changes in the core classes signatures?
Otherwise I guess it can only be a major release bump 🤔
| ->args([ | ||
| '$client' => service(Client::class), | ||
| '$serializer' => service('serializer'), | ||
| '$serializer' => abstract_arg('elastically.abstract.document_serializer'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a BC Break, as the Client $serializer argument is supposed to be a SerializerInterface.
Maybe it should be named differently? ($documentSerializer?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damienalexandre should be Backward compatible now, let me know what you think
| '$serializer' => abstract_arg('elastically.abstract.document_serializer'), | ||
| '$bulkMaxSize' => abstract_arg('bulk size'), | ||
| '$bulkRequestParams' => [], | ||
| '$contextBuilder' => abstract_arg('elastically.abstract.static_context_builder'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark, it could be a BC Break to remove this 🤔
The less we change the Client arguments the better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could do some kind of Adapter implementing Serializer interface and internaly using the streamer, but it feels kinda dodgy
| */ | ||
| private function supports(object $document): bool | ||
| { | ||
| $key = \sprintf('elastically_supports_%s', md5($document::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use the modern and faster xxHash instead of MD5:
| $key = \sprintf('elastically_supports_%s', md5($document::class)); | |
| $key = \sprintf('elastically_supports_%s', hash('xxh128', $document::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point thanks! I used xxh3 as it is the fastest and collision are unlikely
|
Saddly I cannot use the JsonStreamer to read the response as it uses the denormalizer (which is normal as data is already an array at this point) |
Fixes #216