Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Scout Laravel Package

laravel/scout

Laravel Scout adds driver-based full-text search to Eloquent models, automatically syncing model changes to your search indexes. Supports Algolia, Meilisearch, and Typesense, with configuration and usage documented on laravel.com.

View on GitHub
Deep Wiki
Context7

Laravel Scout provides a driver based solution to searching your Eloquent models.

Frequently asked questions about Scout
How do I install Laravel Scout in a Laravel project?
Run `composer require laravel/scout` to install the package. Then configure your preferred search driver (Algolia, Meilisearch, or Typesense) in the `.env` file under `SCOUT_DRIVER`. Follow the official [Laravel Scout documentation](https://laravel.com/docs/scout) for driver-specific setup steps.
Which Laravel versions does Scout support?
Laravel Scout is officially supported for Laravel 10.x and 11.x. Check the [package requirements](https://packagist.org/packages/laravel/scout) for compatibility with your Laravel version. Older versions may work but aren’t guaranteed to receive updates.
Can I use Scout with a self-hosted search engine like Meilisearch?
Yes, Scout supports self-hosted engines like Meilisearch and Typesense. Configure the connection details in `.env` (e.g., `SCOUT_MEILISEARCH_HOST=http://localhost:7700`) and ensure your server meets the engine’s system requirements. Self-hosting is cost-effective for high-volume searches.
How does Scout handle model indexing automatically?
Scout uses Eloquent model observers to automatically index records when they are created, updated, or deleted. This happens via the `Searchable` trait, which triggers `saved` and `deleted` events. For large datasets, indexing runs asynchronously via Laravel queues.
What if I need custom search fields or computed attributes?
Override the `toSearchableArray()` method in your model to define which fields or computed attributes should be indexed. For example, return an array with nested data or dynamically generated values. Scout will use this method to populate the search index.
Is Scout suitable for production with high query volumes?
Yes, but performance depends on your driver. Algolia scales well for enterprise needs but can be costly. Meilisearch and Typesense are optimized for high throughput and self-hosting. Monitor queue backlogs and consider optimizing `toSearchableArray()` for large payloads to avoid bottlenecks.
How do I search for records using Scout?
Use the `search()` method on your model. For example, `User::search('john')->get()` returns matching records. Scout also supports query modifiers like `where`, `orderBy`, and `paginate()` for advanced filtering. Refer to the [documentation](https://laravel.com/docs/scout#searching) for syntax details.
What are the alternatives to Laravel Scout for full-text search?
Alternatives include Laravel’s built-in `database` driver (limited full-text support), third-party packages like `spatie/laravel-searchable`, or standalone solutions like Elasticsearch with custom integrations. Scout stands out for its seamless Eloquent integration and driver flexibility.
How do I handle search relevance tuning or custom scoring?
Relevance tuning depends on your driver. Algolia and Typesense offer advanced scoring options via their APIs, while Meilisearch uses ranking rules. For custom logic, extend Scout’s `Builder` class or use driver-specific query parameters. Test with real data to refine results.
Can I use Scout with Laravel queues for async indexing?
Yes, Scout uses Laravel’s queue system to process indexing tasks asynchronously. Configure your queue connection (e.g., Redis, database) in `.env` and ensure workers are running. Async indexing prevents timeouts for large datasets and improves performance.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai