Rollback PHP to 7.4
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tyler
2020-12-27 02:53:41 -05:00
parent a1ac81a73a
commit 9daa8a6667
7 changed files with 73 additions and 9 deletions

View File

@ -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',
]
]
],
]
];
}

View File

@ -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',
]
]
],
]
];
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Services\Search;
use ScoutElastic\IndexConfigurator;
class AuthorConfigurator extends IndexConfigurator
{
// It's not obligatory to determine name. By default it'll be a snaked class name without `IndexConfigurator` part.
protected $name = 'authors';
// You can specify any settings you want, for example, analyzers.
protected $settings = [
];
}

View File

@ -10,13 +10,5 @@ class BookConfigurator extends IndexConfigurator
// You can specify any settings you want, for example, analyzers.
protected $settings = [
'analysis' => [
'analyzer' => [
'es_std' => [
'type' => 'standard',
'stopwords' => '_spanish_'
]
]
]
];
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Services\Search;
use ScoutElastic\IndexConfigurator;
class LocationConfigurator extends IndexConfigurator
{
// It's not obligatory to determine name. By default it'll be a snaked class name without `IndexConfigurator` part.
protected $name = 'locations';
// You can specify any settings you want, for example, analyzers.
protected $settings = [
];
}