This commit is contained in:
@ -2,10 +2,16 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Search\AuthorConfigurator;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ScoutElastic\Searchable;
|
||||
|
||||
class Author extends Model {
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $indexConfigurator = AuthorConfigurator::class;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
@ -18,4 +24,18 @@ class Author extends Model {
|
||||
public function books() {
|
||||
return $this->belongsToMany(Book::class);
|
||||
}
|
||||
|
||||
protected $mapping = [
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'type' => 'text',
|
||||
// Also you can configure multi-fields, more details you can find here https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html
|
||||
'fields' => [
|
||||
'raw' => [
|
||||
'type' => 'keyword',
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -2,10 +2,16 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Search\LocationConfigurator;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ScoutElastic\Searchable;
|
||||
|
||||
class Location extends Model {
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $indexConfigurator = LocationConfigurator::class;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
@ -18,4 +24,18 @@ class Location extends Model {
|
||||
public function books() {
|
||||
return $this->hasMany(Book::class);
|
||||
}
|
||||
|
||||
protected $mapping = [
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'type' => 'text',
|
||||
// Also you can configure multi-fields, more details you can find here https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html
|
||||
'fields' => [
|
||||
'raw' => [
|
||||
'type' => 'keyword',
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user