Giter Site home page Giter Site logo

teamtnt / laravel-scout-tntsearch-driver Goto Github PK

View Code? Open in Web Editor NEW
1.1K 18.0 140.0 201 KB

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

License: MIT License

PHP 100.00%
laravel-scout tntsearch-driver tntsearch laravel hacktoberfest laravel-package

laravel-scout-tntsearch-driver's People

Contributors

billypoke avatar bretvanhorn avatar dominiquedutra avatar eshimischi avatar gaelenb avatar hexpande avatar it4need avatar laravel-shift avatar michaelklopf avatar n0script avatar nticaric avatar olivsinz avatar phanan avatar pktharindu avatar rf1705 avatar robgridley avatar rodrigotroche avatar ryanthompson avatar sesze avatar shopapps avatar stokic avatar tarekbazine avatar tehwave avatar thewebartisan7 avatar tpodg avatar vlopes11 avatar wedrix avatar xdamman avatar ybr-nx avatar zerglinggo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-scout-tntsearch-driver's Issues

Driver upgrade to Laravel 5.4

Hi,

In order to use the driver in Laravel 5.4, a change is needed into TNTSearchServiceProvider.

The method share was extinct.

So, my suggestion is to change the share method line, by this one:

$this->app->singleton('tntsearch',function ($app) {

It works.

Index does not exist.

I find when saving an entry for the first time without manually making the index I get this error.

It really should auto-create the index (upon second attempt it works fine). Creating indexes in not in the Scout behavior and as such should be done in the background.

Thoughts?

Pagination not working

Laravel Scout paginate not working when using 'tntsearch'. The pagination working well when using 'algolia' driver.

Relation search

Hi all!

I need help to search in models hasMany relation,
something like:
$model->companies->search('Company name')->get();

My model relation looks like this;

public function companies() {
    return $this->hasMany(Company::class);
}

Thanks!

$asYouType option in config/scout.php

Hi guys

Great package. I couldn't find any documentation surrounding 'as you type' or quite how to use it in conjunction with the package. For now I have hardcoded it to true in vendor which is certainly wrong.

Should this be a config option? Or is there a way to use it on a per search basis i.e.

$result = App\Stuff::search($keyword)->asYouType()->get();

Apologies if I have missed something obvious, I did Google for quite some time.

Error when import table

when i want to import a table, i get this error:

[Symfony\Component\Debug\Exception\FatalErrorException]
  Class TeamTNT\Scout\Engines\TNTSearchEngine contains 1 abstract method and must therefore be declared abst
  ract or implement the remaining methods (Laravel\Scout\Engines\Engine::mapIds)

Where and order by conditons aren't changing result set

None of these queries seems to have any effect on the result set of my Ads model:

Ad::search($query)->where('type_id', $type)->get();
Ad::search($query)->orderBy('created_at', 'desc')->get();

Am I doing something wrong or is this something tntsearch driver doesn't support yet?

Display results with a WHERE CLAUSE

Hello ,

I try to display my search results with a WHERE condition but the condition have no effect with TNT Search . i know that this feature is not include in the driver actually but today there is a solution for this ? maybe with filters method ?

Best regards

Laravel 5.4

Please support v5.4

$app->share()

is now

$app->singleton()

Error when trying to search

I get the following error when trying to do Model::search('query')->get():

"TNTSearchEngine contains 1 abstract method and must therefore be declared abstract or implement the remaining methods"

I am using Laravel 5.3. (Using https://github.com/codecasts/spa-starter-kit)
I have installed Scout as indicated in the Laravel documentation.

Any ideas what could be causing this?

Return specific columns

Hello, i want to make this query:

$persons = Person::search($search_value)->get(['id', 'first_name]);

Can anyone tell me if this is possible?

Exclude model instances from being indexed ?

$indexer->query("SELECT $query FROM {$model->getTable()};");

With this in the ImportCommand hwo can we customize and pass model scopes?

I don't need search index for all draft, not visible and soft deleted records.
But at the moment it index everything, and i need to make a second index update removing the indexes that shouldn't be there in a first place.

Partial word search returns no result?

I am having trouble configuring the search... and can't find the documentation to give me the understanding I need of the issue. I love the package and was hoping someone with a bit more knowledge could point me in the right direction.

I'm using the package to search through names of my users... I have the default fuzziness settings:

    'tntsearch' => [
        'storage'  => storage_path() . '/indexes', //place where the index files will be stored
        'fuzziness' => env('TNTSEARCH_FUZZINESS', true),
        'fuzzy' => [
            'prefix_length' => 2,
            'max_expansions' => 50,
            'distance' => 2
        ],
    ],

I have a user with the name Vivienne... and if I search for vivi.. then her name doesn't appear in the search results. The first time it appears is if I get to Vivien (which I think is related to the "distance" of 2).

I was hoping I could type the first part of the name (viv or vivi) and get a result on the full name. Is there a way to change my configuration to allow this? Or do I have to try and type out the full name to find it?

Thanks.

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 ?

Undefined Offset (intermittent)

While using this package in Canvas, I'm finding that the search function intermittently throws an undefined offset error. Can't find any consistency with the errors, but have just run into it many times. An example looks like this:

screen shot 2017-02-24 at 1 09 31 pm

If you want to try and reproduce the error, try a quick installation of Canvas and then sign into the app, and utilize the search function in the top navigation bar.

Filtering Results

Am I correct to assume that using where filters through scout is not implemented yet? I see the engine's filters method but it's not being used at all.

If there's an alternate way about it I would love a pointer - thanks!

Undefined index: id

When creating a user i get this error:

ErrorException: Undefined index: id

/Users/Scott/Code/IOTM/vendor/teamtnt/tntsearch/src/Support/Collection.php:68
/Users/Scott/Code/IOTM/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:279
/Users/Scott/Code/IOTM/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:284
/Users/Scott/Code/IOTM/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:292
/Users/Scott/Code/IOTM/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php:44
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Support/Collection.php:228
/Users/Scott/Code/IOTM/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php:48
/Users/Scott/Code/IOTM/vendor/laravel/scout/src/Jobs/MakeSearchable.php:43
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:94
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:98
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:47
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:73
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:42
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:184
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:159
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:73
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:373
/Users/Scott/Code/IOTM/vendor/laravel/scout/src/Searchable.php:61
/Users/Scott/Code/IOTM/vendor/laravel/scout/src/Searchable.php:35
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:78
/Users/Scott/Code/IOTM/vendor/laravel/scout/src/Searchable.php:112
/Users/Scott/Code/IOTM/vendor/laravel/scout/src/ModelObserver.php:61
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:348
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:221
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1664
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1592
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1471
/Users/Scott/Code/IOTM/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php:116
/Users/Scott/Code/IOTM/tests/features/Search/BandAvailabilitySearchTest.php:18
/Users/Scott/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:185
/Users/Scott/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:115

app\User.php

    public function toSearchableArray()
    {
        $search = collect($this->toArray())->only([
            'name',
            'email',
        ])->toArray();

        $search['address'] = isset($this->address)
            ? implode(' ', $this->address->toSearchableArray())
            : '';

        $search['profile'] = isset($this->profile)
            ? implode(' ', $this->profile->toSearchableArray())
            : '';

        dump($search);
        /*
         * dump() outputs
         array:4 [
             "name" => "Dr. Golden Price Sr."
             "email" => "[email protected]"
             "address" => ""
             "profile" => ""
         ]
         */

        return $search;
    }

The format of the array is correct based on the dump() output, correct?

Prioritizing columns

I'm having some issues with the ranking. Is there any way to tell the driver to prioritize results that contain a match in the title rather than in the body? Right now it seems both columns have equal weight and the posts I'm looking for almost never show at the top.

Thanks!

Undefined var username when testing against an sqlite database

I'm trying to run unit tests against an sqlite database in memory with the following credentials:

[
            'driver'   => 'sqlite',
            'database' => ':memory:',
            'prefix'   => '',
            'strict'   => false,
]

However when I run them i get the following error:

ErrorException: Undefined variable: username in /home/talv/Projects/easel/vendor/teamtnt/tntsearch/src/Connectors/Connector.php:46

The problem arises from the extract function not having a $username and $password keys to extract:

    public function createConnection($dsn, array $config, array $options)
    {
        extract($config, EXTR_SKIP);

        return new PDO($dsn, $username, $password, $options);

    }

I then created 2 null values within my database connection for username and password and it got passed the connector part however it brings the following errors

PDOException: SQLSTATE[HY000]: General error: 1 no such table: posts in /home/talv/Projects/easel/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php:173
Stack trace:
#0 /home/talv/Projects/easel/vendor/teamtnt/tntsearch/src/Indexer/TNTIndexer.php(173): PDO->query('SELECT id, titl...')
#1 /home/talv/Projects/easel/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(167): TeamTNT\TNTSearch\Indexer\TNTIndexer->run()
#2 /home/talv/Projects/easel/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(33): TeamTNT\Scout\Engines\TNTSearchEngine->initIndex(Object(Easel\Models\Post))
#3 /home/talv/Projects/easel/vendor/laravel/scout/src/Searchable.php(41): TeamTNT\Scout\Engines\TNTSearchEngine->update(Object(Illuminate\Database\Eloquent\Collection))
#4 /home/talv/Projects/easel/vendor/laravel/scout/src/Searchable.php(24): Easel\Models\Tag->queueMakeSearchable(Object(Illuminate\Database\Eloquent\Collection))
#5 [internal function]: Illuminate\Database\Eloquent\Collection->Laravel\Scout\{closure}()
#6 /home/talv/Projects/easel/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php(78): call_user_func_array(Object(Closure), Array)
#7 /home/talv/Projects/easel/vendor/laravel/scout/src/Searchable.php(87): Illuminate\Support\Collection->__call('searchable', Array)
#8 /home/talv/Projects/easel/vendor/laravel/scout/src/ModelObserver.php(61): Easel\Models\Post->searchable()
#9 [internal function]: Laravel\Scout\ModelObserver->created(Object(Easel\Models\Post))
.....

It seems thats the migrations to create the tables break with the introduction of username and password keys for the sqlite databases in memory.

Any ideas on how to fix the above?

Removing the tests for searching and the username and password keys allows all my tests to work as normal.

Fuzzy Search

Is it possible to use or configure fuzzy search? I've managed to use it without scout, but it would be great to enable fuzzines using the scout driver :)

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?

Batch Import

I want to import a table with about 5 million rows and it runs out of memory. Is there a way to import them in batches using the tntsearch:import?

Also, having filtering would make this package a must in every project.

One index for multiple models

I've got a project where I have news and comments. I managed to get everything up and running in no time, but I can't figure out the best way to search in multiple models at once.

Right now I have an index per model. I guess I could overwrite that, but then I would have duplicate ID's. I could then create a custom index like news-1, comment-1, but that feels awfully ugly.

What's the best practice to search in multiple models?

Undefined offset

I have a form where a user starts typing the name of a product. As they type, the string is sent via ajax to a ProductController which basically does the the following:

$products = Product::search($value)->take(8)->get();

However, while the user is typing I get the following error:

capture

This only happens when the part of the product name is typed. Once the user types the full product name everything works.

This error occurs on my local setup only. I deployed my application to forge and everything works flawlessly. Is there some setting I need to change in my php.ini file?

[Suggestion] asYouType runtime option

Would it make sense to have an option to enable/disable asYouType runtime? Like, if your app would need both. At least I have different places on my page, that searches differently:

  • some that shows results beneath; autocompletion/typeahead-ish
  • and one that only returns on ENTER (hence no need for asYouType)

I'd gladly spend some time looking into a solution and create a PR.

Take with paginate not working

$var = Model::search($query)->take(30)->paginate(15);

or

$var = Model::search($query, 30)->paginate(15);

will just return all values for $query, paginated. The limit does not seem to work at all or I'm doing something wrong.

Search part of words (LIKE %something%) ?

Hi,
First of all thanks a lot for your work, really love tntsearch and especially nice and easy laravel integration.

Is it possible to do in the middle of word search like classic sql LIKE '%something%'?
As I plan to use it for autocomplete, would really like to give users some results when they omit the first letter of word or similar.
Other thing is if for example if I search for "kind" it will find results with "kind" but not for e.g. "kinder", is there any setting to make it return also words that just begin with search term?
Also its working nicely on my local system but I'm a bit worried about live performance when I get many hits to api and when my db grows (currently I have around 45000 records) - is there any performance benchmark data or something similar available?

Few suggestions to add to documentation

Explain what each parameter does:

'tntsearch' => [
    'storage'  => storage_path(), //place where the index files will be stored
    'fuzziness' => env('TNTSEARCH_FUZZINESS', false),
    'fuzzy' => [
        'prefix_length' => 2,  //The number of initial characters which will not be “fuzzified”. This helps to reduce the number of terms which must be examined.
        'max_expansions' => 50, //The maximum number of terms that the fuzzy query will expand to. Defaults to 50
        'distance' => 2  //the number of one character changes that need to be made to one string to make it the same as another string
    ],
],

I borrowed the explanations from elasticsearch where I found them:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html

I'm not sure I understand what happens here:

//fields you want to make searchable
public function toSearchableArray()
{
    $array = $this->toArray();

    // Customize array...

    return $array;
}

Could you explain it on an example. Also is boosting of columns possible? Didn't find it in the docs but would be really nice.

Also, as a non linguist, I think the letters U & Ü, C & Ç and so on should be treated as the same.

Thanks for the great package. Keep it up.

UPDATE:
This should be moved to https://github.com/teamtnt/tntsearch/issues/ but I don't know can it be done?

write a readonly database

i got this error ,

[PDOException]
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

Error in TNTSearchScoutServiceProvider@boot

i installed your package but i get this error when i want to run my application

Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Support\Manager

i think the error refer to this line:
$this->app[EngineManager::class]->extend('tntsearch', function () {

Recommend storing indexes in git?

Firstly, thanks for providing this driver and saving me a lot of time writing it myself!

Do you recommend storing the indexes in git or generating them on each platform you pull your repo from?

Thanks

SearchableAs is equal to table

Hello,

as a multi database user - i need to define the exact name of index.
I have to tables with name 'users' and three models. "User", "FrontendUser", "BackendUser".
FrontendUser and BackendUser extends User and look for users on different database connections.

The table name is always "users".

Index of "users_index" will be created. And there is the problem.
As of now there is no possibility to make something like frontend_users_index, right?

Can you make a alternative model variable which can define the index name?

Undefined offset: 0

I get an 'Undefined offset: 0' error whenever I chain a paginate() method to a search query returning an empty collection.

How to replicate:
Perform a search for a query that doesn't return any items and chain ->paginate() to it.

[2016-08-25 09:23:32] local.ERROR: ErrorException: Undefined offset: 0 in /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1257
Stack trace:
#0 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1257): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined offse...', '/home/vagrant/C...', 1257, Array)
#1 /home/vagrant/Code/serverlist/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(151): Illuminate\Support\Collection->offsetGet(false)
#2 [internal function]: TeamTNT\Scout\Engines\TNTSearchEngine->TeamTNT\Scout\Engines\{closure}(false, 0)
#3 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Support/Collection.php(597): array_map(Object(Closure), Array, Array)
#4 /home/vagrant/Code/serverlist/vendor/teamtnt/laravel-scout-tntsearch-driver/src/Engines/TNTSearchEngine.php(152): Illuminate\Support\Collection->map(Object(Closure))
#5 /home/vagrant/Code/serverlist/vendor/laravel/scout/src/Builder.php(133): TeamTNT\Scout\Engines\TNTSearchEngine->map(Array, Object(App\Server))
#6 /home/vagrant/Code/serverlist/app/Http/Controllers/SearchController.php(14): Laravel\Scout\Builder->paginate(20)
#7 [internal function]: App\Http\Controllers\SearchController->searchServer(Object(Illuminate\Http\Request))
#8 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(52): call_user_func_array(Array, Array)
#9 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\Routing\Controller->callAction('searchServer', Array)
#10 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Route.php(189): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\SearchController), 'searchServer')
#11 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Route.php(144): Illuminate\Routing\Route->runController()
#12 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Router.php(642): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#13 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#14 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#18 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#27 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#33 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Router.php(644): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#34 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Router.php(618): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#35 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Router.php(596): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#36 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(263): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#37 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#38 /home/vagrant/Code/serverlist/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#42 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#45 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(149): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#46 /home/vagrant/Code/serverlist/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#47 /home/vagrant/Code/serverlist/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#48 {main}  

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

Integrating TNTSearch with Easel has hit a bug on line 199 of src/TNTSearchScoutServiceProvider.php.

Any assistance on the solution would be great! 👍

If you want to replicate the error, go ahead and follow these steps:

  • git clone https://github.com/cnvs/canvas.git
  • git checkout develop
  • cp .env.example .env
  • composer install
  • php artisan canvas:install

Some issues along the way of installing tntsearch with fixes

if you run this command

php artisan scout:import "App\Contact"

and you encounter this error

[ErrorException]                      
Trying to get property of non-object

Then it might be related to your model scope function, So disable it and then run the command again.

Or if you encounter something like

[Symfony\Component\Debug\Exception\FatalThrowableError]  
Class 'AlgoliaSearch\Version' not found  

then clear config cache like so, and then run the command again

php artisan config:clear

I hope these will help someone

btw, i'm using Laravel 5.4

memory error

hi ,
If a table contain to many record ( 180k )
when i import this table , he stop on the memory limit :
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2656 bytes)
is there a solution ?

[ErrorException] Empty row packet body

Did anyone receive "[ErrorException] Empty row packet body" on use artisan tntsearch:import "model..." ?

This occurs after processe more than 36000 rows, every time in same point.

Is there an way to debug this?

Undefined offset Error when result exists

Hi, I'm getting this error on my deployed server but not on my local machine (deploying by Forge@DigitalOcean, locally I'm using Homestead).

The error log:

in Collection.php line 1274
at HandleExceptions->handleError('8', 'Undefined offset: 209', '/home/forge/mysite.hr/vendor/laravel/framework/src/Illuminate/Support/Collection.php', '1274', array('key' => '209')) in Collection.php line 1274
at Collection->offsetGet('209') in TNTSearchEngine.php line 158
at TNTSearchEngine->TeamTNT\Scout\Engines{closure}('209', '0')
at array_map(object(Closure), array('209'), array('0')) in Collection.php line 597
at Collection->map(object(Closure)) in TNTSearchEngine.php line 159
at TNTSearchEngine->map(array('ids' => array('209'), 'execution time' => '0.6032 ms'), object(Element)) in Engine.php line 62
at Engine->get(object(Builder)) in Builder.php line 115
at Builder->get() in ControllerInWhichICallTheSerachMethod.php line 57

Depending on the size of the string the error will be Undefined offset: 209 or Undefined offset: 205 and so on.

Please do ask if you have any questions.

import model with specific condition

Hi ! me again !
i'd like to know if it's possible to index a model with a specific condition .
i have a model Stock , with many article in stock .
an article can have a stat inStock , and a stat outStock .
i would like ton index only article instock ,is it possible ?

Relational Search

Hi, Thanks for this awesome package. Can you please tell me how to implement something like this
I have 2 tables

Movies (hasManyActors)
Actors (belongsToMovies)

now i want to search movies by actor name. I have read on forums that I may need to use egar load but how to implement this for larvel scout search?

Movies::whereHas('actors', function ($q) {
   $q->where('name', 'like', 'abc');
})->with('actors')->get();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.