spatie/laravel-site-search
Crawl and index your Laravel site for fast full-text search—like a private Google. Highly customizable crawling and indexing, with concurrent requests. Uses SQLite FTS5 by default (no external services), or Meilisearch for advanced features.
site_search_documents table and database-specific FTS infrastructure (e.g., SQLite virtual tables). Minimal schema changes but requires migration testing in staging.spatie/crawler, which may introduce rate-limiting risks if the site has aggressive robots.txt rules or anti-scraping measures (e.g., Cloudflare). Mitigation: Customize SearchProfile to throttle requests.site-search:crawl), so queue workers must be configured (e.g., Redis, database). Sync mode (--sync) is available for debugging but not production-recommended.| Risk Area | Severity | Mitigation |
|---|---|---|
| Crawl Performance | High | Test with --sync first; monitor failed URLs in site-search:list. |
| Database Bloat | Medium | SQLite/PostgreSQL handle FTS well, but MySQL’s FULLTEXT has limitations. Consider Meilisearch for large indexes. |
| Dynamic Content | High | Crawler may miss JS-rendered content. Use headless Chrome crawler (e.g., spatie/crawler-puppeteer) for SPAs. |
| Index Staleness | Medium | No built-in reindexing triggers. Schedule crawls via Laravel Scheduler or integrate with eloquent-observers for model updates. |
| Customization Complexity | Medium | Extending SearchProfile/Indexer requires PHP knowledge. Document custom logic in a separate config file for maintainability. |
Indexer logic.robots.txt but may need adjustments for private routes.# Failed in site-search:list)?Indexer logic.ArrayDriver in a staging environment to validate content extraction./docs).--sync to debug and adjust SearchProfile/Indexer.0 3 * * * php artisan site-search:crawl).driver_class in config/site-search.php.Search::onIndex()->query()->get().hit->highlightedSnippet() and hit->url.pg_trgm extension for fuzzy search.DefaultSearchProfile to filter URLs (e.g., exclude /admin).DefaultIndexer to extract custom fields (e.g., product price, author name).composer require spatie/laravel-site-search.php artisan vendor:publish --provider="Spatie\SiteSearch\SiteSearchServiceProvider".config/site-search.php (driver, default profile).php artisan site-search:create-index (name + URL).php artisan site-search:crawl --sync (debug with ArrayDriver).site-search:list for failures.SearchProfile to limit crawl scope (e.g., /blog/* only).php artisan site-search:list to track failed URLs and crawl status.Post is updated)..sqlite file regularly.pg_stat_activity for long-running FTS queries.How can I help you explore Laravel packages today?