nqxcode / laravel-lucene-search

Laravel 4.2, 5.* package for full-text search over Eloquent models based on ZF2 Lucene.
73 stars 28 forks source link

Call to undefined method Nqxcode\LuceneSearch\Search::where() #41

Closed nkusibojoski closed 7 years ago

nkusibojoski commented 7 years ago

I have done all as it is described in the usage of this package, run the command "php artisan search:rebuild --verbose" , but when I try to get some results from the search I got this error "Call to undefined method Nqxcode\LuceneSearch\Search::where()" . I am using Laravel 5.2

Here is the code in my controller : $query = Search::where('name', 'clock'); $models = $query->get(); dd($models); And here is the index : 'index' => [ 'path' => storage_path('app') . '/lucene-search/index',

    'models' => [
        // Add models descriptions here.
        App\Models\Pet::class => [
            'fields' => [
                'name', 'short_description', // fields for indexing
            ],
            'boost' => true
        ],
        App\Models\Breed::class => [
            'fields' => [
                'name' // fields for indexing
            ],                
            'boost' => true
        ],
    ],
],
nqxcode commented 7 years ago

You should use \Search::where(), but not Nqxcode\LuceneSearch\Search::where().

nkusibojoski commented 7 years ago

Thanks a lot, it worked !