Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

Last update: May 17, 2022

TNTSearch Driver for Laravel Scout - Laravel 5.3 - 8.0

Backers on Open Collective Sponsors on Open Collective Latest Version on Packagist Software License Build Status Quality Score Total Downloads

This package makes it easy to add full text search support to your models with Laravel 5.3 to 8.0.

Premium products

If you find TNT Search to be one of your valuable assets, take a look at one of our premium products

Support us on Open Collective

Contents

Installation

You can install the package via composer:

composer require teamtnt/laravel-scout-tntsearch-driver

Add the service provider:

// config/app.php
'providers' => [
    // ...
    TeamTNT\Scout\TNTSearchScoutServiceProvider::class,
],

Ensure you have Laravel Scout as a provider too otherwise you will get an "unresolvable dependency" error

// config/app.php
'providers' => [
    // ...
    Laravel\Scout\ScoutServiceProvider::class,
],

Add SCOUT_DRIVER=tntsearch to your .env file

Then you should publish scout.php configuration file to your config directory

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

In your config/scout.php add:

'tntsearch' => [
    'storage'  => storage_path(), //place where the index files will be stored
    'fuzziness' => env('TNTSEARCH_FUZZINESS', false),
    'fuzzy' => [
        'prefix_length' => 2,
        'max_expansions' => 50,
        'distance' => 2
    ],
    'asYouType' => false,
    'searchBoolean' => env('TNTSEARCH_BOOLEAN', false),
    'maxDocs' => env('TNTSEARCH_MAX_DOCS', 500),
],

To prevent your search indexes being commited to your project repository, add the following line to your .gitignore file.

/storage/*.index

The asYouType option can be set per model basis, see the example below.

Usage

After you have installed scout and the TNTSearch driver, you need to add the Searchable trait to your models that you want to make searchable. Additionaly, define the fields you want to make searchable by defining the toSearchableArray method on the model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Post extends Model
{
    use Searchable;

    public $asYouType = true;

    /**
     * Get the indexable data array for the model.
     *
     * @return array
     */
    public function toSearchableArray()
    {
        $array = $this->toArray();

        // Customize array...

        return $array;
    }
}

Then, sync the data with the search service like:

php artisan scout:import App\\Post

If you have a lot of records and want to speed it up you can run (note that with this you can no longer use model-relations in your toSearchableArray()):

php artisan tntsearch:import App\\Post

After that you can search your models with:

Post::search('Bugs Bunny')->get();

Scout status

php artisan scout:status

With this simple command you'll get a quick overview of your search indices.

Image of Scout Status Command

Or you can pass a searchable model argument:

php artisan scout:status "App\Models\Post"

Image of Scout Status Command

Constraints

Additionally to where() statements as conditions, you're able to use Eloquent queries to constrain your search. This allows you to take relationships into account.

If you make use of this, the search command has to be called after all queries have been defined in your controller.

The where() statements you already know can be applied everywhere.

namespace App\Http\Controllers;

use App\Post;

class PostController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $post = new Post;

        // filter out posts to which the given topic is assigned
        if($request->topic) {
            $post = $post->whereNotIn('id', function($query){
                $query->select('assigned_to')->from('comments')->where('topic','=', request()->input('topic'));
            });
        }

        // only posts from people that are no moderators
        $post = $post->byRole('moderator','!=');

        // when user is not admin filter out internal posts
        if(!auth()->user()->hasRole('admin'))
        {
            $post= $post->where('internal_post', false);
        }

        if ($request->searchTerm) {
            $constraints = $post; // not necessary but for better readability
            $post = Department::search($request->searchTerm)->constrain($constraints);
        }

        $post->where('deleted', false);

        $post->orderBy('updated_at', 'asc');

        $paginator = $post->paginate(10);
        $posts = $paginator->getCollection();

        // return posts
    }
}

Adding via Query

The searchable() method will chunk the results of the query and add the records to your search index.

$post = Post::find(1);

// You may also add record via collection...
$post->searchable();

// OR

$posts = Post::where('year', '>', '2018')->get();

// You may also add records via collections...
$posts->searchable();

When using constraints apply it after the constraints are added to the query, as seen in the above example.

OrderBy

An orderBy() statement can now be applied to the search query similar to the where() statement.

When using constraints apply it after the constraints are added to the query, as seen in the above example.

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Credits

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers! 🙏 [Become a backer]

GitHub

https://github.com/teamtnt/laravel-scout-tntsearch-driver
Comments
  • 1. TNTSearch for Million records

    Hi. I have imported ~ million record into tntsearch storage. Now the search is getting more then 10s to show results. How can I speed up?

    PS I have a server with 18 Cores and 64GB RAM and I'm testing there

    I'm using:

    • Laravel 5.7

    • laravel-scout-tntsearch-driver 3.2

    Here is my configs 'tntsearch' => [ 'storage' => storage_path() . '/tntsearch', //place where the index files will be stored 'fuzziness' => env('TNTSEARCH_FUZZINESS', true), 'fuzzy' => [ 'prefix_length' => 2, 'max_expansions' => 50, 'distance' => 3 ], 'asYouType' => true, 'searchBoolean' => env('TNTSEARCH_BOOLEAN', false), ],

    Reviewed by alkhachatryan at 2018-12-20 15:08
  • 2. Search optimization

    Hey! Great plugin, i have implemented it in a laravel project i'm working on, and i've indexed the data using tntsearch:import. It took in total pretty much bang on 1 hour to do 2494456 rows, which was impressive compared to the vanilla scout import command. The model that i'm using is a Product and has many columns in the MySQL database, however, i've stored in the search index only the ID and the name for now (using toSearchableArray on the model)

    However, speed is intermittently faster/slower when testing it out. Some strings i try come back quickly, and more complex words come back slower, usually the longer the product name is (and more complex, like alphanumeric) the slower it'll be.

    Luckily it's still way quicker than plain MySQL text search. Is there anything i can do to speed it up even more though? I assumed that indexing only them two columns should be quick enough, i've not changed any of the default config settings for tntsearch either. For example on timings "HP Pavilion 15-au076sa" 6seconds on average (quite slow) "Hayfever Tablets" 200milliseconds on average (perfect!)

    Hopefully i've included as much information about this as i can that could be useful, hopefully also the import statistic is useful to you guys as i couldn't find any import statistics (from people using using tntsearch:import) in the github issues! Any tips on how to make these searches any faster on the product name?

    Also, is there anyway to only return certain columns from the model when using ::search? At the moment it takes everything, which i think could be slowing it down a little bit too on complex products (like having long descriptions) I tried select and pluck but to no avail. Would this be a factor in slowing it down? Just a thought.

    Thanks!

    Reviewed by MikeSheward at 2017-04-26 20:35
  • 3. Declaration of TeamTNT\Scout\Engines\TNTSearchEngine::map($results, $model) must be compatible with Laravel\Scout\Engines\Engine::map(Laravel\Scout\Builder $builder, $results, $model)

    Declaration of TeamTNT\Scout\Engines\TNTSearchEngine::map($results, $model) must be compatible with Laravel\Scout\Engines\Engine::map(Laravel\Scout\Builder $builder, $results, $model)

    I am receiving this exception when calling search() on a model.

    I have temporarily fixed this by changing the signature of the map function from public function map($results, $model) to public function map(Builder $builder, $results, $model)

    Reviewed by bradley-varol at 2018-08-02 02:20
  • 4. very low import model .

    Hi ! i'm trying to import différent model , who have différent size , i think the import is very very low ..... more than one hour , for a table with 30k record. it's normal ?

    i have a intel core i7 with ssd and 16GO memory . it's note a hardware issue.

    What do you think ?

    Reviewed by valerogeoffrey at 2016-08-25 19:10
  • 5. SQLSTATE[HY000]: General error: 21 library routine called out of sequence

    I receive SQLSTATE[HY000]: General error: 21 library routine called out of sequence when reindexing models. This happens in TNTIndexer.php in saveWordList($stems) function. Anyone has any idea how to fix this?

    Reviewed by jjag3r at 2017-12-11 11:12
  • 6. QueryException when when more than 1 model indexed

    Hi guys,

    This is a bit strange, as I swear it was working at one point. Now however it seems broken.

    I have 2 models, App\Page & App\Advice - their toSearchableArray both look similar - like below:

    public function toSearchableArray() {
        $search = [
            'title'    => $this->title,
            'category' => $this->category,
            'subject'  => $this->subject,
            'intro'    => strip_tags($this->intro),
            'content'  => strip_tags($this->content),
            'tags'     => is_array($this->tags) ? implode(' ',$this->tags) : ''
        ];
    
        $search[$this->getKeyName()] = $this->getKey();
    
        return $search;
    }
    

    Now I run the command php artisan tntsearch:import App\\Page

    Search the works as I'd expect, returning results no problem for pages (or, if I instead only indexed with App\Advice Advice gets searched fine too)

    However when both are index using the above command, I suddenly start hitting error 500 like the below:

    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'advices.id' in 'where clause' (SQL: select * from `pages` where `pages`.`id` in (20, 18, 1, 19, 13, 24, 27, 12, 10, 26, 17, 32, 15, 14, 35, 3, 33, 34, 44, 7, 4, 38, 5, 2) and `advices`.`id` in (33, 37, 19, 41, 18, 40, 5, 43, 29, 7, 28, 48, 72, 15, 75, 31, 59, 51, 81, 58, 30, 52, 77, 11, 62, 46, 23, 45, 60, 47, 35, 56, 54, 79, 68, 61, 83, 20, 34, 42, 50, 38, 63, 55, 70, 36, 3, 73, 49, 10, 25, 69, 22, 71, 76, 64, 78, 66, 65, 84, 67, 8, 16, 27, 74, 4, 9, 53, 39, 57, 17, 6, 13, 80, 32, 21, 14))
    

    It dies on line 205 on /src/Engines/TNTSearchEngine.php - if that's helpful.

    Is there something I'm missing?

    Reviewed by Cookizza at 2018-09-13 09:02
  • 7. leftJoinSub() is not a method in Laravel<5.6

    Trying to apply pagination on a query with where clauses results in an error for L5.5 or older. leftJoinSub() is only a method in L5.6.

    Call to undefined method Illuminate\Database\Query\Builder::leftJoinSub()

    Reviewed by pdanny at 2018-07-14 00:45
  • 8. SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected?

    I try to use laravel scout in my app its giving errors when i hit the submit button.But when I use tinker its giving me result I changed in TNTSearch.php line 67 sqlite to mysql. Then its giving errors. Any help Thanks

    Reviewed by vipin733 at 2017-01-14 14:15
  • 9. Use with an external connection on the model

    Hey,

    I have a Customer model as follows:

    <?php
    
    class Customer extends Model {
        use Searchable;
    
        protected $connection = 'external_connection';
    
        public $searchable = [ /* ... */ ];
    }
    

    I then run:

    $ php artisan scout:import App\\Customer
    

    And get the following error:

    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'my-app.customers' doesn't exist
    
    Exception trace:
     () at /Users/Josh/Code/my-app/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:180
     PDO->query() at /Users/Josh/Code/my-app/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:180
     TeamTNT\TNTSearch\Indexer\TNTIndexer->run() at /Users/Josh/Code/my-app/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php:167
     TeamTNT\Scout\Engines\TNTSearchEngine->initIndex() at /Users/Josh/Code/my-app/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php:33
     TeamTNT\Scout\Engines\TNTSearchEngine->update() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/Searchable.php:52
     App\Customer->queueMakeSearchable() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/Searchable.php:35
     Illuminate\Database\Eloquent\Collection->Laravel\Scout\{closure}() at n/a:n/a
     call_user_func_array() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:78
     Illuminate\Support\Collection->__call() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/SearchableScope.php:34
     Laravel\Scout\SearchableScope->Laravel\Scout\{closure}() at n/a:n/a
     call_user_func() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:378
     Illuminate\Database\Eloquent\Builder->chunk() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/SearchableScope.php:37
     Laravel\Scout\SearchableScope->Laravel\Scout\{closure}() at n/a:n/a
     call_user_func_array() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1412
     Illuminate\Database\Eloquent\Builder->__call() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/Searchable.php:88
     App\Customer::makeAllSearchable() at /Users/Josh/Code/my-app/vendor/laravel/scout/src/Console/ImportCommand.php:43
     Laravel\Scout\Console\ImportCommand->handle() at n/a:n/a
     call_user_func_array() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
     Illuminate\Container\Container->call() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
     Illuminate\Console\Command->execute() at /Users/Josh/Code/my-app/vendor/symfony/console/Command/Command.php:256
     Symfony\Component\Console\Command\Command->run() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
     Illuminate\Console\Command->run() at /Users/Josh/Code/my-app/vendor/symfony/console/Application.php:818
     Symfony\Component\Console\Application->doRunCommand() at /Users/Josh/Code/my-app/vendor/symfony/console/Application.php:186
     Symfony\Component\Console\Application->doRun() at /Users/Josh/Code/my-app/vendor/symfony/console/Application.php:117
     Symfony\Component\Console\Application->run() at /Users/Josh/Code/my-app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:111
     Illuminate\Foundation\Console\Kernel->handle() at /Users/Josh/Code/my-app/artisan:35
    

    I've tried importing the same model using the Algolia driver and it imports fine.

    It seems like it's trying to use the default connection instead of the custom connection I have specified on the model.

    Any ideas on how to fix this?

    Reviewed by josh-taylor at 2016-08-23 11:47
  • 10. SQLSTATE[HY000]: General error: 5 database is locked

    Hi there,

    I'm getting the database being locked every day or so. I'm running quite a high traffic site with multiple indeces and they're seemingly auto-locking which is breaking functionality every day..

    Any fix to this?

    Reviewed by MadMikeyB at 2018-03-28 18:46
  • 11. Laravel Scout with tntsearch returns empty array

    Hey, I have set up Laravel Scout with tntsearch according to the documentation. Only thing I did on top was that I set up database queue driver. When I try to search a model with the ::search all I get is empty array.

    Controller test function:

    public function test()
        {
            $search = Store::search('test')->get();
            return view('test')->with('search', $search);
        }
    

    Store model:

    <?php
    
    namespace App;
    
    use Illuminate\Database\Eloquent\Model;
    use Illuminate\Database\Eloquent\SoftDeletes;
    use Laravel\Scout\Searchable;
    
    class Store extends Model
    {
        use SoftDeletes;
    
        use Searchable;
    
        protected $dates = ['deleted_at'];
    
        protected $fillable = ['name', 'url', 'contact', 'description', 'detail', 'featured', 'network_id', 'currency_id',
            'link', 'comment', 'category_id'];
    
        protected $with = ['favoritable'];
    
        /**
         * Get the indexable data array for the model.
         *
         * @return array
         */
        public function toSearchableArray()
        {
            $array = $this->toArray();
    
            // Customize array...
    
            return $array;
        }
    
        public function categories()
        {
            return $this->belongsToMany('App\Category');
        }
    
        public function network()
        {
            return $this->belongsTo('App\Network');
        }
    
        public function currency()
        {
            return $this->belongsTo('App\Currency');
        }
    
        public function favoritable()
        {
            return $this->belongsTo('App\Favoritable', 'favoritable_id', 'favoritable_id');
        }
    }
    
    

    the result is :

    [ ]
    

    Do you know what can cause this.

    Reviewed by cawrvus at 2017-05-28 10:39
  • 12. When search term is part of different words in the index wordlist, only first matching is returned

    Hey,

    Lets have a look at this case:

    • there are several documents about java, javascript etc..
    • the wordlist table in the search index sqlite has the terms 'java', 'javascript', 'javase' , 'java-interview'
    • asYouType is enabled
    • a user is searching for 'java' and expects to get results for 'java', 'javascript' , etc...

    Only search results for 'java' are returned because TNTSearch::getWordlistByKeyword only returns 'java' because of SELECT * FROM wordlist WHERE term like :keyword ORDER BY length(term) ASC, num_hits DESC LIMIT 1 (l. 308) --> is this by mistake or by intention? In my opinion, when asYouType is enabled the wordlist returned should contain all the words starting with 'java', so the LIMIT 1 could be removed?

    Reviewed by mk-conn at 2022-05-04 21:57
  • 13. Search with relationship(s)

    Hi, is there any way to use Model::search method via with() function? I'd like to search through my User model which has Role This is my original code: User::with('roles')->paginate($this->paginate)

    So my question is, how can I make it searchable?

    Reviewed by schubertadam at 2022-01-10 22:33
  • 14. Error While Indexing

    I am getting this error when indexing Can you tell how to solve this?

    D:\laragon_new\www\oneCart>php artisan scout:import "App\Product"
    
       ErrorException  : Trying to access array offset on value of type bool
    
      at D:\laragon_new\www\oneCart\vendor\teamtnt\tntsearch\src\TNTSearch.php:398
        394|     {
        395|         $query = "SELECT * FROM info WHERE key = '$value'";
        396|         $docs  = $this->index->query($query);
        397|
      > 398|         return $docs->fetch(PDO::FETCH_ASSOC)['value'];
        399|     }
        400|
        401|     public function filesystemMapIdsToPaths($docs)
        402|     {
    
      Exception trace:
    
      1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Trying to access array offset on value of type bool", "D:\laragon_new\www\oneCart\vendor\teamtnt\tntsearch\src\TNTSearch.php", ["stemmer", "SELECT * FROM info WHERE key = 'stemmer'", Object(PDOStatement)])
          D:\laragon_new\www\oneCart\vendor\teamtnt\tntsearch\src\TNTSearch.php:398
    
      2   TeamTNT\TNTSearch\TNTSearch::getValueFromInfoTable("stemmer")
          D:\laragon_new\www\oneCart\vendor\teamtnt\tntsearch\src\TNTSearch.php:377
    
    

    Please use the argument -v to see more details.

    Reviewed by blpraveen at 2021-08-31 16:49
  • 15. Undefined array key "id"

    local.ERROR: Undefined array key "id" {"exception":"[object] (ErrorException(code: 0): Undefined array key "id" at M:\Projects\welistall\AL-Rewards\vendor\teamtnt\tntsearch\src\Support\Collection.php:96) [stacktrace] #0 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\tntsearch\src\Support\Collection.php(96): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Undefined array...', 'M:\\Projects\\wel...', 96) #1 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\tntsearch\src\Indexer\TNTIndexer.php(383): TeamTNT\TNTSearch\Support\Collection->get('id') #2 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\tntsearch\src\Indexer\TNTIndexer.php(398): TeamTNT\TNTSearch\Indexer\TNTIndexer->processDocument(Object(TeamTNT\TNTSearch\Support\Collection)) #3 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\tntsearch\src\Indexer\TNTIndexer.php(406): TeamTNT\TNTSearch\Indexer\TNTIndexer->insert(Array) #4 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\laravel-scout-tntsearch-driver\src\Engines\TNTSearchEngine.php(69): TeamTNT\TNTSearch\Indexer\TNTIndexer->update(10, Array) #5 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Collections\Traits\EnumeratesValues.php(234): TeamTNT\Scout\Engines\TNTSearchEngine->TeamTNT\Scout\Engines\{closure}(Object(App\Models\SearchMerchantConfig), 0) #6 M:\Projects\welistall\AL-Rewards\vendor\teamtnt\laravel-scout-tntsearch-driver\src\Engines\TNTSearchEngine.php(73): Illuminate\Support\Collection->each(Object(Closure)) #7 M:\Projects\welistall\AL-Rewards\vendor\laravel\scout\src\Jobs\MakeSearchable.php(42): TeamTNT\Scout\Engines\TNTSearchEngine->update(Object(Illuminate\Database\Eloquent\Collection)) #8 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Laravel\Scout\Jobs\MakeSearchable->handle() #9 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #10 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #11 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #12 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\Container.php(614): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #13 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(128): Illuminate\Container\Container->call(Array) #14 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Laravel\Scout\Jobs\MakeSearchable)) #15 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Laravel\Scout\Jobs\MakeSearchable)) #16 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #17 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow(Object(Laravel\Scout\Jobs\MakeSearchable), false) #18 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Laravel\Scout\Jobs\MakeSearchable)) #19 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Laravel\Scout\Jobs\MakeSearchable)) #20 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #21 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\RedisJob), Object(Laravel\Scout\Jobs\MakeSearchable)) #22 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array) #23 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(414): Illuminate\Queue\Jobs\Job->fire() #24 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(364): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions)) #25 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions)) #26 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(117): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\WorkerOptions)) #27 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default') #28 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle() #29 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #30 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure)) #31 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #32 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Container\Container.php(614): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #33 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Console\Command.php(136): Illuminate\Container\Container->call(Array) #34 M:\Projects\welistall\AL-Rewards\vendor\symfony\console\Command\Command.php(288): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #35 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Console\Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #36 M:\Projects\welistall\AL-Rewards\vendor\symfony\console\Application.php(974): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #37 M:\Projects\welistall\AL-Rewards\vendor\symfony\console\Application.php(291): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #38 M:\Projects\welistall\AL-Rewards\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #39 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Console\Application.php(92): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #40 M:\Projects\welistall\AL-Rewards\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #41 M:\Projects\welistall\AL-Rewards\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #42 {main} "}

    Reviewed by erichtiong at 2021-08-31 04:54
  • 16. Reload Configuration before search

    I have a situation similar to #169 where I need to run a boolean search followed by a regular search. After programmatically changing the config, the settings were not being applied in the second search.

                    //.env contains
                    //SCOUT_DRIVER=tntsearch
                    //SCOUT_QUEUE=true
                    //TNTSEARCH_BOOLEAN=true
    
                    $illustrations = Illustration::search($search_string)->get(); //Boolean as expected
                    $ids = $illustrations->pluck('id');
                    $rel_constraints = new Illustration;
                    $rel_constraints = $rel_constraints->whereIn('id',$ids);
                    config(['scout.tntsearch.searchBoolean' => false]);
                    $rel_illustrations = Illustration::search($search_string)->constrain($rel_constraints)->get(); //Still Boolean
    

    I may be mistaken about this, but it seems $tnt->loadConfig($config); is only run once in TNTSearchScoutServiceProvider boot(), so changing the config elsewhere never gets applied.

    Reviewed by mefenlon at 2021-07-01 18:59
Laravel Scout provides a driver based solution to searching your Eloquent models.

Introduction Laravel Scout provides a simple, driver-based solution for adding full-text search to your Eloquent models. Once Scout is installed and c

May 15, 2022
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 This package provide a Laravel/Scout Engine based on database/fulltext only,

Apr 26, 2022
Elasticsearch driver for Laravel Scout
Elasticsearch driver for Laravel Scout

Elasticsearch driver for Laravel Scout. Contents Compatibility Installation Configuration Basic Usage Advanced Search Migrations Pitfalls Compatibilit

May 20, 2022
Search among multiple models with ElasticSearch and Laravel Scout
Search among multiple models with ElasticSearch and Laravel Scout

For PHP8 support use php8 branch For Laravel Framework < 6.0.0 use 3.x branch The package provides the perfect starting point to integrate ElasticSear

May 19, 2022
[Deprecated] We now recommend using Laravel Scout, see =>

[DEPRECATED] Algolia Search API Client for Laravel Algolia Search is a hosted full-text, numerical, and faceted search engine capable of delivering re

May 10, 2022
Illusionist Searcher - Generates database queries based on search syntax

Illusionist Searcher Generates database queries based on search syntax. English | 中文 ✨ Features Zero configuration Compatible with laravel/scout and l

Feb 24, 2022
A search package for Laravel 5.

Search Package for Laravel 5 This package provides a unified API across a variety of different full text search services. It currently supports driver

Mar 17, 2022
Laravel package to search through multiple Eloquent models. Supports sorting, pagination, scoped queries, eager load relationships and searching through single or multiple columns.

Laravel Cross Eloquent Search This Laravel package allows you to search through multiple Eloquent models. It supports sorting, pagination, scoped quer

May 18, 2022
Laravel Searchable - This package makes it easy to get structured search from a variety of sources
Laravel Searchable - This package makes it easy to get structured search from a variety of sources

This package makes it easy to get structured search from a variety of sources. Here's an example where we search through some model

May 13, 2022
SphinxQL Query Builder generates SphinxQL, a SQL dialect, which is used to query the Sphinx search engine. (Composer Package)

Query Builder for SphinxQL About This is a SphinxQL Query Builder used to work with SphinxQL, a SQL dialect used with the Sphinx search engine and it'

Apr 27, 2022
A php trait to search laravel models

Searchable, a search trait for Laravel Searchable is a trait for Laravel 4.2+ and Laravel 5.0 that adds a simple search function to Eloquent Models. S

May 17, 2022
Unmaintained: Laravel Searchy makes user driven searching easy with fuzzy search, basic string matching and more to come!

!! UNMAINTAINED !! This package is no longer maintained Please see Issue #117 Here are some links to alternatives that you may be able to use (I do no

May 2, 2022
This is an open source demo of smart search feature implemented with Laravel and Selectize plugin
This is an open source demo of smart search feature implemented with Laravel and Selectize plugin

Laravel smart search implementation See demo at: http://demos.maxoffsky.com/shop-search/ Tutorial at: http://maxoffsky.com/code-blog/laravel-shop-tuto

Sep 16, 2021
A fully featured full text search engine written in PHP
A fully featured full text search engine written in PHP

TNTSearch TNTSearch is a full-text search (FTS) engine written entirely in PHP. A simple configuration allows you to add an amazing search experience

May 20, 2022
Sphinx Search library provides SphinxQL indexing and searching features

Sphinx Search Sphinx Search library provides SphinxQL indexing and searching features. Introduction Installation Configuration (simple) Usage Search I

Mar 14, 2022
Kirby docs search workflow for Alfred
Kirby docs search workflow for Alfred

Kirby Docs search workflow for Alfred 4 An ultra-fast Kirby Docs search workflow for Alfred 4 Installation Download the latest version Install the wor

Feb 22, 2022
Build and execute an Elasticsearch search query using a fluent PHP API
Build and execute an Elasticsearch search query using a fluent PHP API

PACKAGE IN DEVELOPMENT, DO NOT USE YET Build and execute ElasticSearch queries using a fluent PHP API This package is a lightweight query builder for

May 5, 2022
A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.

Apache Solr for TYPO3 CMS A TYPO3 extension that integrates the Apache Solr enterprise search server with TYPO3 CMS. The extension has initially been

Apr 22, 2022
A site search engine
A site search engine

THIS PACKAGE IS IN DEVELOPMENT, DO NOT USE IN PRODUCTION YET A site search engine This package can crawl your entire site and index it. Support us We

May 13, 2022