Skip to content
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

Refactored the DeleteJob to use 'deleteObjects' instead of 'deleteBy' #334

Merged

Conversation

simonworkhouse
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #311
Need Doc update yes

Describe your change

This change is to account for the fact that the 'deleteBy' method has been deprecated on the new NeuralSearch infrastructure.

We have been advised of this by the Algolia support team and they have stated that it's a requirement in order to use the new infrastructure.

This update should also address the issue outlined in #311

This change is to account for the fact that the 'deleteBy' method has
been deprecated on the new NeuralSearch infrastructure.

We have been advised of this by the Algolia support team and they
have stated that it's a requirement in order to use the new
infrastructure.
Copy link
Contributor

@DevinCodes DevinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @simonworkhouse ,

thank you for your contribution. Apologies for the CI that didn't run as expected before, I think there's some issues with permissions for external contributors.

I was able to run the test suite with your changes, but there are still some failing tests that need to be addressed before this could be merged. Let me know if you run into any issues 🙂

Thank you in advance!

@simonworkhouse
Copy link
Contributor Author

simonworkhouse commented Feb 16, 2024

@DevinCodes No troubles, I have updated the tests to account for the updated DeleteJob behaviour.

Copy link
Contributor

@DevinCodes DevinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for the contribution @simonworkhouse , it seems to be working as expected.

Going over the changes, I realized that this change has an impact on the usage of search operation: the deleteBy is an indexing operation, while browse is counted as search operation. Given that this might impact some customer's usage and billing, we may want to have this as a configurable option rather than the default behavior, which would default to using deleteBy. WDYT?

I realize adding this option takes up more of your time, so let me know if you want a hand on adding this. Love to know your thoughts on it as well.

Thanks again!

@simonworkhouse
Copy link
Contributor Author

@DevinCodes We were informed by the Algolia support team that the deleteBy operation had been deprecated, is that not the case? Or is that perhaps just for the new "NeuralSearch" infrastructure? To be honest, I wasn't able to find that documented anywhere but the support team were adamant that it is the case.

Yes, it's probably a good idea to have it set up as a configurable option regardless, but maybe I'll first triple check with the support team just to make sure that they aren't confused.

@DevinCodes
Copy link
Contributor

It is deprecated only for the new infrastructure indeed: plans on the old infra should still have access to this operation 🙂

@simonworkhouse
Copy link
Contributor Author

I have added a configuration option scout.algolia.use_deprecated_delete_by that controls whether or not to use the deprecated deleteBy method. Tests have also been updated to account for both methods of deletion.

A check for this has been added into the DeleteJob with a default fallback value of true so that it does not change existing behaviour.

...
if (config('scout.algolia.use_deprecated_delete_by', true)) {
...

I did also consider the possibility of implementing and dispatching a new Job class instead, but rejected that idea due to the potential for breaking backwards compatibility. It would have potentially caused issues if someone is either manually dispatching DeleteJobs or if they have extended that class.

Copy link
Contributor

@DevinCodes DevinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the contribution @simonworkhouse, this is looking great. I'll merge and deploy a new version first thing Monday morning!

@DevinCodes DevinCodes merged commit 264a5ff into algolia:master Feb 26, 2024
5 checks passed
@DevinCodes
Copy link
Contributor

This is released and available in v3.0.1! Thank you again for your contribution!

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.

deleteBy throwing Algolia's limit rate on bulk delete
2 participants