PHPackages                             ivanomatteo/laravel-scout-fulltext-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. ivanomatteo/laravel-scout-fulltext-engine

ActiveLibrary[Search &amp; Filtering](/categories/search)

ivanomatteo/laravel-scout-fulltext-engine
=========================================

A scout DB fulltext-based driver that store index data in related tables

0.2.1(3mo ago)101.1k↓33.3%1[4 PRs](https://github.com/ivanomatteo/laravel-scout-fulltext-engine/pulls)MITPHPPHP ^8.2CI passing

Since Apr 12Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/ivanomatteo/laravel-scout-fulltext-engine)[ Packagist](https://packagist.org/packages/ivanomatteo/laravel-scout-fulltext-engine)[ Docs](https://github.com/ivanomatteo/laravel-scout-fulltext-engine)[ RSS](/packages/ivanomatteo-laravel-scout-fulltext-engine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (21)Used By (0)

A scout DB fulltext-based driver that store index data in related tables
========================================================================

[](#a-scout-db-fulltext-based-driver-that-store-index-data-in-related-tables)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c0eac1b23d07f50dc0de3ce8d815b0918c109dd3bd11389b31c839523b9fe7d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976616e6f6d617474656f2f6c61726176656c2d73636f75742d66756c6c746578742d656e67696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/laravel-scout-fulltext-engine)[![GitHub Tests Action Status](https://camo.githubusercontent.com/37acc6570a5b9423380e99735d595473fd210d1d6a672388b7b6d6920bc3d4f6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6976616e6f6d617474656f2f6c61726176656c2d73636f75742d66756c6c746578742d656e67696e652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/ivanomatteo/laravel-scout-fulltext-engine/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub PhpStan Action Status](https://camo.githubusercontent.com/9ff8cd3ef15c17dde672c46e3b25d9eca73d8753b193997ea61dda908ba4e0d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6976616e6f6d617474656f2f6c61726176656c2d73636f75742d66756c6c746578742d656e67696e652f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e)](https://github.com/ivanomatteo/laravel-scout-fulltext-engine/actions/workflows/phpstan.yml?query=branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9912c46cf551c596a9d89b431a244c7274c8507575905d8069891bf9e856f61b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6976616e6f6d617474656f2f6c61726176656c2d73636f75742d66756c6c746578742d656e67696e652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/ivanomatteo/laravel-scout-fulltext-engine/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b42a1b8d9d12ebe2c8946c57e889b0bdbe02ccbce758aa76cc85b77af66904af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976616e6f6d617474656f2f6c61726176656c2d73636f75742d66756c6c746578742d656e67696e652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/laravel-scout-fulltext-engine)

This package provide a Laravel/Scout Engine based on database/fulltext only, but work in a different way compared to the default database Engine.

You don't need to add fulltext indexes to your tables: the data used for search will be stored in a table with a polymorphic relation.

This provide several advantages:

- you don't need to change current tables's schema
- it's easy to add metadata
- indexing process can be deferred in jobs, so it will not slow down database inserts/updates

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ivanomatteo/laravel-scout-fulltext-engine
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="scout-fulltext-engine-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="scout-fulltext-engine-config"
```

This is the contents of the published config file:

```
use IvanoMatteo\LaravelScoutFullTextEngine\Parsers\Extractors\CompositeNameExtractor;
use IvanoMatteo\LaravelScoutFullTextEngine\Parsers\Query\QueryParserMysqlFullTextBool;

return [

    'scout_engine_name' => 'scout-fulltext-engine',

    'fulltext_options' => [

        'mode' => 'boolean',

        /*
            Note on bind_mode == 'join':
                it will try to modify selected columns by
                adding "model_table.*" if no column was selected or
                adding "model_table." prefix to selected columns.
                In some cases, for example when using DB::raw(),
                you must be careful because the query will be a join,
                and you have to avoid column names collisions
        */
        'bind_mode' => 'exists', // 'exists' | 'join'

        /*
            By default fulltext searches will return records
            ordered by match score:
                but in some case you may want the records to be ordered by
                multiple fields, for example: match_score, name
                in these cases is necessary to be explicit
            !!! only supported with bind_mode = 'join'
        */
        'order_by_score' => false,

        // this will add a field named 'fulltext_score' to the results.
        // it can be useful for tuning fulltext searches
        // !!! only supported with bind_mode = 'join'
        'add_select_score' => false,
    ],

    'pre_processing' => [
        'query' => [
            // the parser will process the text passed to
            // search function preparing it for the specific
            // fulltext query type
            'parser' => QueryParserMysqlFullTextBool::class,

            // Extractors will extrapolate metadata from the query text

            'extractors' => [
                [
                    // useful to match dotted words
                    // must be used also in index_data section
                    // "N.A.S.A"  --extract--> [ "NASA", "N_A_S_A" ]
                    'class' => DottedWordsExtractor::class,
                    'must_match' => false, // true -> will prepend "+", for boolean mode, but depends by the parser class
                    'starts_with' => true, // true -> will append "*", for boolean mode, but depends by the parser class
                ],
                [
                    // composite name extractor will find words
                    // composed by 1 or 2 characters followed by
                    // a word longer than 3 characters, for example:
                    // from "Robert De Niro" --extract--> [ "De_niro" ]
                    // this is useful to overcome fulltext default words min-length (3 chars)
                    // (but it will work only if used also in index data section)
                    'class' => CompositeNameExtractor::class,
                    'must_match' => false,
                    'starts_with' => true,
                ]
            ],
        ],

        'index_data' => [
            'extractors' => [
                //this will add extracted metadata to te index
                DottedWordsExtractor::class,
                CompositeNameExtractor::class,
            ],
        ],
    ],

];
```

Storing indexed data in different tables
----------------------------------------

[](#storing-indexed-data-in-different-tables)

It's also possible use different tables to store indexed data:

- creating another table with the same structure of "full\_text\_entries"
- the model (that should extend FullTextEntry)

and adding this method to your models:

```
public function getFullTextEntryModel()
{
    return FullTextEntry2::class;
}
```

Usage
-----

[](#usage)

Simply configure Laravel Scout to use this driver: (in your .env file)

```
SCOUT_DRIVER=scout-fulltext-engine

```

and refer to [laravel scout documentation](https://laravel.com/docs/scout) for standard usage.

Direct Search Mode
------------------

[](#direct-search-mode)

This package also provide a "direct search" mode: you just need to add DirectSearch Trait to your Model:

```
use Laravel\Scout\Searchable;
use IvanoMatteo\LaravelScoutFullTextEngine\Concerns\DirectSearch;

class MyModel extends Model
{
    use Searchable;
    use DirectSearch;

}
```

In this way you will get:

- **fullTextEntry()**: relation to indexed table
- **directSearch()**: scope, that you can use intead of search()

Scout's **search()** function, returns an instance of **Laravel\\Scout\\Builder** that has limited functionalities.

**directSearch()** instead, will return an instance of **Illuminate\\Database\\Eloquent\\Builder** that allow you to build your query as usual.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ivano Matteo](https://github.com/ivanomatteo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance80

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~92 days

Recently: every ~294 days

Total

16

Last Release

103d ago

PHP version history (2 changes)0.1.0PHP ^8.0

0.2.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35255310?v=4)[Ivano Matteo](/maintainers/IvanoMatteo)[@ivanomatteo](https://github.com/ivanomatteo)

---

Top Contributors

[![ivanomatteo](https://avatars.githubusercontent.com/u/35255310?v=4)](https://github.com/ivanomatteo "ivanomatteo (83 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![allcreatures](https://avatars.githubusercontent.com/u/69415?v=4)](https://github.com/allcreatures "allcreatures (1 commits)")

---

Tags

laravelivanomatteolaravel-scout-fulltext-engine

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ivanomatteo-laravel-scout-fulltext-engine/health.svg)

```
[![Health](https://phpackages.com/badges/ivanomatteo-laravel-scout-fulltext-engine/health.svg)](https://phpackages.com/packages/ivanomatteo-laravel-scout-fulltext-engine)
```

###  Alternatives

[spatie/laravel-site-search

A site search engine

300129.1k](/packages/spatie-laravel-site-search)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
