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

Laravel Site Search Laravel Package

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.

View on GitHub
Deep Wiki
Context7

title: Using the database driver weight: 5

The database driver is the default driver. It stores search documents in your application's database and uses the database's native full-text search capabilities. SQLite (FTS5), MySQL (FULLTEXT), and PostgreSQL (tsvector) are all supported.

How it works

The database driver stores all indexed documents in a single site_search_documents table. Each document is associated with an index_name, which allows multiple search indexes to coexist in the same table.

Full-text search infrastructure (virtual tables, indexes, triggers) is created automatically at runtime based on which database you are using. The migration itself is database-agnostic.

Database-specific behavior

SQLite uses FTS5 virtual tables with porter stemming and unicode support. BM25 ranking weights matches in headings higher than body content. Highlighted snippets are generated natively by FTS5.

MySQL uses FULLTEXT indexes with boolean mode search. Highlighting is done in PHP after the query.

PostgreSQL uses tsvector columns with GIN indexes and weighted vectors. ts_rank() is used for ranking and ts_headline() for highlighting.

Search features

All three databases provide:

  • Full-text search with stemming (e.g. "running" matches "run")
  • Prefix matching (e.g. "auth" matches "authentication")
  • Relevance ranking with field-specific weights
  • Highlighted snippets with matching terms wrapped in <em> tags
  • Deep linking with anchor links to specific sections (see Retrieving results)

Using a different database connection

By default, the database driver uses your application's default database connection. You can use a different connection by setting a database.connection value in the extra attribute of the site_search_configs table:

{"database": {"connection": "mysql"}}

This lets you store search data in a separate database from your application data.

Differences from the Meilisearch driver

  • No external service required, uses your existing database
  • No support for synonyms or custom ranking rules
  • Indexing is synchronous (no background processing)
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport