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.
A search profile determines which pages get crawled and what content gets indexed. In the site-search config file, you'll find in the default_profile key that the Spatie\SiteSearch\Profiles\DefaultSearchProfile::class is being used by default.
This default profile will instruct the indexing process:
200 as the status code of its responsesite-search-do-not-indexBy default, the crawling process will respect the robots.txt of your site.
A search profile is also responsible for determining which indexer will be used for a certain page. An indexer is responsible for determining the title, content, description, ... of a page. By default, Spatie\SiteSearch\Indexers\DefaultIndexer will get used. To know more about indexers and how to customize them, head over to the section on indexers.
If you want to customize the crawling and indexing behavior, you could opt to extend Spatie\SiteSearch\Profiles\DefaultSearchProfile or create your own class that implements the Spatie\SiteSearch\Profiles\SearchProfile interface. This is how that interface looks like.
namespace Spatie\SiteSearch\Profiles;
use Spatie\Crawler\Crawler;
use Spatie\Crawler\CrawlResponse;
use Spatie\SiteSearch\Indexers\Indexer;
interface SearchProfile
{
public function shouldCrawl(string $url): bool;
public function shouldIndex(string $url, CrawlResponse $response): bool;
public function useIndexer(string $url, CrawlResponse $response): ?Indexer;
public function configureCrawler(Crawler $crawler): void;
}
How can I help you explore Laravel packages today?