larasearch icon indicating copy to clipboard operation
larasearch copied to clipboard

larasearch:reindex -> Call to undefined method Illuminate\Database\Query\Builder::reindex()

Open prigal opened this issue 10 years ago • 1 comments

Hello,

Thanks for your work, can't wait to test it, but I have an issue and I don't understand.

When I run

php artisan larasearch:reindex App\\Product --relations

I got this trace :

---> Reindexing App\Product

  [BadMethodCallException]                                               
  Call to undefined method Illuminate\Database\Query\Builder::reindex()  

This is my model :

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use Iverberk\Larasearch\Traits\SearchableTrait;

class Product extends Model
{

    /**
     * Get the requests for the product.
     */
    public function requests()
    {
        return $this->hasMany('App\Request');
    }
}

I'm using Laravel 5.1 with your devL5 branch.

Previous command was ok :

php artisan larasearch:paths 'App\Product' --relations
{
    "paths": {
        "App\\Product": []
    },
    "reversedPaths": {
        "App\\Product": [
            ""
        ]
    }
}

And localhost:9200 :

{
  "status" : 200,
  "name" : "Quentin Quire",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.6.0",
    "build_hash" : "cdd3ac4dde4f69524ec0a14de3828cb95bbb86d0",
    "build_timestamp" : "2015-06-09T13:36:34Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

Thanks for your help.

prigal avatar Jul 10 '15 07:07 prigal

Can be closed, in fact I have the same problem of this issue : #94

My error comes from

use Iverberk\Larasearch\Traits\SearchableTrait;

which was placed before

class Product extends Model

and should be after...

prigal avatar Jul 14 '15 10:07 prigal