This commit is contained in:
parent
a1ac81a73a
commit
9daa8a6667
@ -1,3 +1,3 @@
|
||||
FROM php:8-fpm-alpine
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
@ -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',
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
14
app/Services/Search/AuthorConfigurator.php
Normal file
14
app/Services/Search/AuthorConfigurator.php
Normal 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 = [
|
||||
];
|
||||
}
|
@ -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_'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
14
app/Services/Search/LocationConfigurator.php
Normal file
14
app/Services/Search/LocationConfigurator.php
Normal 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 = [
|
||||
];
|
||||
}
|
4
public/mix-manifest.json
Normal file
4
public/mix-manifest.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"/js/app.js": "/js/app.js",
|
||||
"/css/app.css": "/css/app.css"
|
||||
}
|
Loading…
Reference in New Issue
Block a user