Full-text Search with Algolia

Configure Algolia Search

The system has pre-configured search functionality to enable full-text search and it’s FREE. But if you’re a fan of Algolia, you can use the search provider.

Info! Algolia is a premium service and may cost you to use the service! Check the Algolia site for more info.

To configure Algolia, you need your algolia APP ID and SECRET KEY from Algolia. Head to your Algolia dashboard and go to the API keys section. You’ll find the API keys there. Now open the .env file and update these keys with your values.

.
.
.
.
SCOUT_DRIVER=algolia
.
.
ALGOLIA_APP_ID=YourApplicationID
ALGOLIA_SECRET=YourAdminAPIKey
.
.
.

You don’t have to do anything more. The application will take care of everything you need to index your data to Algolia.

Import Existing Data

If you configured the Algolia when you already have data in your database. You will be required to import the existing data into the Algolia service to get them on search results. To import run these below commands on your terminal.

php artisan scout:import "App\Models\Product";
php artisan scout:import "App\Models\Inventory";
php artisan scout:import "App\Models\Customer";
php artisan scout:import "App\Models\Category";

After completing the import the search should work as before but using Algolia.

Was this page helpful?

Leave Comment