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

Add Support for Algolia V4 - Breaking Change #862

Closed
wants to merge 27 commits into from

Conversation

TheoGibbons
Copy link

This pull request updates the Laravel Scout package to support Algolia V4. This update addresses the lack of compatibility with Algolia V4, as discussed in Issue #855.

Key Changes:

  • Added support for Algolia V4.
  • Removed support for Algolia V3, making this a breaking change.
  • Removed support for PHP 8.0 as Algolia V4 requires php 8.1

This guide helped with the upgrade: Algolia V4 Upgrade Guide.

Please review the following:

  1. I'll leave it up to you whether this should be merged, considering the breaking change that removes Algolia V3 compatibility and introduces a PHP 8.1 requirement.
  2. I'm not sure why the Meilisearch checks are failing, as this update shouldn't have affected them. It looks like they are just timing out 🤷
  3. I've had this running in production for two days without issue.

I've updated the Upgrade guide as requested by taylorotwell
I created a pull request onto the 10.X branch but driesvints requested it to be sent to the 11.x branch instead.

driesvints and others added 27 commits June 18, 2024 18:54
…el#845 (laravel#846)

* feat(typesense): sync server state in getOrCreateCollectionFromModel

This commit updates the `getOrCreateCollectionFromModel` method in
`TypesenseEngine` to verify if a collection exists on the server. If not
found, it is created. This ensures consistency between the worker and
server states.

* style: fix styleCI errors

refactor: remove uneeded cast of flag

The collectionExists flag was already cast as false, so recasting it
serves no purpose

* Update TypesenseEngine.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
* refactor(typesense): remove unused exists checks

In laravel#820 we introduced an exists check method, which then lead to static state issues as described in laravel#845

Those where addressed in laravel#846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.

* Update TypesenseEngine.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
NOTE: This is not backwards compatible with V3
# Conflicts:
#	CHANGELOG.md
#	src/Scout.php
#	tests/Unit/AlgoliaEngineTest.php
Remove the test for php 8.0
@TheoGibbons TheoGibbons changed the title 11.x Add Support for Algolia V4 - Breaking Change Sep 3, 2024
@driesvints
Copy link
Member

Thanks @TheoGibbons. As you can see we have some merge conflicts here and some duplicate commits. I just merged 10.x into 11.x so could you please try to rebase anew from 11.x and resend the PR?

@driesvints driesvints closed this Sep 4, 2024
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.

8 participants