teamtnt / laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
MIT License
1.09k stars 142 forks source link

TNTSearchEngine.php doesn't implement 3 methods from Laravel Scout #323

Closed huytrvan closed 3 years ago

huytrvan commented 3 years ago

Hello,

I ran the follwing command in Laravel Lumen: php artisan scout:import App\\Models\\Modem

And I got this error: error_tntsearch

PHP Fatal error:  Class TeamTNT\Scout\Engines\TNTSearchEngine contains 3 abstract methods and must therefore 
be declared abstract or implement the remaining methods (Laravel\Scout\Engines\Engine::lazyMap, Laravel\Scout\
Engines\Engine::createIndex, Laravel\Scout\Engines\Engine::deleteIndex) in D:\Projects\xxx_xxx\vendor\
teamtnt\laravel-scout-tntsearch-driver\src\Engines\TNTSearchEngine.php on line 14

Fatal error: Class TeamTNT\Scout\Engines\TNTSearchEngine contains 3 abstract methods and must therefore be 
declared abstract or implement the remaining methods (Laravel\Scout\Engines\Engine::lazyMap, Laravel\Scout\
Engines\Engine::createIndex, Laravel\Scout\Engines\Engine::deleteIndex) in D:\Projects\xxx_xxx\vendor\
teamtnt\laravel-scout-tntsearch-driver\src\Engines\TNTSearchEngine.php on line 14

In TNTSearchEngine.php line 14:

  Class TeamTNT\Scout\Engines\TNTSearchEngine contains 3 abstract methods and must therefore be declared 
  abstract or implement the remaining methods (Laravel\Scout\Engines\Engine::lazyMap, Laravel\Scout\Engine\
  Engine::createIndex, Laravel\Scout\Engines\Engine::deleteIndex)

Note: php artisan tntsearch:import App\\Models\\Modem works just fine.

I think the file: teamtnt\laravel-scout-tntsearch-driver\src\Engines\TNTSearchEngine.php is missing those 3 methods.

I check this on my other Laravel Project and still same error.

Here is my composer.json:

"require": {
        "php": "^7.3|^8.0",
        "flipbox/lumen-generator": "^8.2",
        "laravel/lumen-framework": "^8.0",
        "teamtnt/laravel-scout-tntsearch-driver": "^11.4"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "phpunit/phpunit": "^9.3"
    },

// ...

Here is my System:

php -v
PHP 8.0.3 (cli) (built: Mar  2 2021 23:34:05) ( ZTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies

windows 7

Any ideas? Thank you.

jurrid commented 3 years ago

Not just Lumen but also the Laravel framework has the same error.

My composer.json

"require": {
  "php": "^7.3|^8.0",
  "fideloper/proxy": "^4.4",
  "fruitcake/laravel-cors": "^2.0",
  "guzzlehttp/guzzle": "^7.0.1",
  "laravel/framework": "^8.40",
  "laravel/scout": "^9.1",
  "laravel/tinker": "^2.5",
  "teamtnt/laravel-scout-tntsearch-driver": "^11.4"
},

My system

PHP 7.4.15 (cli) (built: Feb 27 2021 14:49:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.15, Copyright (c), by Zend Technologies
Cryental commented 3 years ago

Yes I'm getting same error too. Any fixes there?

Cryental commented 3 years ago

with 11.3 version it works perfectly but with 11.4 recent update it's totally broken.

limenet commented 3 years ago

The cause of this issue is 6ca92025013449853ffd6a293a8314f5d3a94eee where an upgrade to laravel/scout to v9 was allowed yet no changes were done to actually support v9 of Scout which would require implementing Laravel\Scout\Engines\Engine::lazyMap, Laravel\Scout\ Engines\Engine::createIndex, Laravel\Scout\Engines\Engine::deleteIndex.

To fix this, you can run composer require laravel/scout:^8.0 to downgrade to v8 of Laravel Scout.

And of course, you can always create a pull request implementing the missing methods 😄