Skip to content

Conversation

@GaryPEGEOT
Copy link
Contributor

Fixes #216

Copy link
Member

@damienalexandre damienalexandre left a 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'),
Copy link
Member

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?)

Copy link
Contributor Author

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'),
Copy link
Member

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.

Copy link
Contributor Author

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));
Copy link
Contributor

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:

Suggested change
$key = \sprintf('elastically_supports_%s', md5($document::class));
$key = \sprintf('elastically_supports_%s', hash('xxh128', $document::class));

Copy link
Contributor Author

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

@GaryPEGEOT GaryPEGEOT changed the title (Draft) feat: add supports for JsonStreamer on indexation feat: add supports for JsonStreamer on indexation Nov 17, 2025
@GaryPEGEOT
Copy link
Contributor Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Add Support for Symfony JsonStreamer

3 participants