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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace Fuse.js with Algolia for home user search #72

Merged
merged 5 commits into from Apr 22, 2021
Merged

replace Fuse.js with Algolia for home user search #72

merged 5 commits into from Apr 22, 2021

Conversation

Gummibeer
Copy link
Member

@Gummibeer Gummibeer commented Apr 22, 2021

blocked by: laravel/framework#37080

In case you have some time @redox this is the PR to replace the current Fuse.js with Algolia & instantsearch.js
The daily re-index seems to be needed as blocked entities aren't part of the index but it's only an update call so the laravel/scout delete isn't called here. I will try to find a better solution.
Okay, without a custom engine this won't work as https://github.com/laravel/scout/blob/7fb1c860a2fd904f0e084a7cc3641eb1448ba278/src/Engines/AlgoliaEngine.php#L46-L73 only calls saveObjects(). The observer https://github.com/laravel/scout/blob/7fb1c860a2fd904f0e084a7cc3641eb1448ba278/src/ModelObserver.php#L75-L88 also makes models unsearchable if they shouldn't be searchable anymore. But not the import command.
Would like to know if it's bad practice to do a full daily re-index of the data? If it will consume my credits/units too fast? Or if that's okay? 馃
EDIT: the scout:reimport command by algolia/scout-extended does the same in a lot nicer way. 馃帀

apply for second category of https://github.com/algolia/algolia-coding-contest

deployment commands:

php artisan scout:sync
php artisan scout:reimport

@Gummibeer Gummibeer self-assigned this Apr 22, 2021
Copy link

@redox redox left a comment

Choose a reason for hiding this comment

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

Added 2 comments, but overall LGTM

app/Models/User.php Show resolved Hide resolved
composer.json Outdated
@@ -22,6 +23,7 @@
"laravel/framework": "^8.12",
"laravel/horizon": "^5.7",
"laravel/nova": "^3.22",
"laravel/scout": "^8.6",
Copy link

Choose a reason for hiding this comment

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

I would encourage using scout-extended in order to be able to customize the specificities of Algolia.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point - will "switch". 馃憤

Copy link
Member Author

Choose a reason for hiding this comment

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

@Gummibeer Gummibeer marked this pull request as ready for review April 22, 2021 10:14
@Gummibeer Gummibeer merged commit 61833ce into dev Apr 22, 2021
@Gummibeer Gummibeer deleted the algolia branch April 22, 2021 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants