Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
matchish authored Nov 13, 2019
1 parent a953fd3 commit 6bda7b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you need any help, [stack overflow](https://stackoverflow.com/questions/tagge

- [Search amongst multiple models](#search-amongst-multiple-models)
- [**Zero downtime** reimport](#zero-downtime-reimport) - it’s a breeze to import data in production.
- [Eager load for relations](#eager-load) - it’s a breeze to import data in production.
- [Eager load relations](#eager-load) - speed up your import.
- Elasticsearch **7.0** ready - Use [elasticsearch-7](https://github.com/matchish/laravel-scout-elasticsearch/tree/elasticsearch-7) branch instead.
- Import all searchable models at once.
- A fully configurable mapping for each model.
Expand Down Expand Up @@ -97,24 +97,25 @@ And for default settings
`elasticsearch.indices.settings.default`

### Eager load
To speed up import you can eager load relations on import only using global scopes.
To speed up import you can eager load relations on import using global scopes.

You should configure inject `ImportSourceFactory` in your service provider(`register` method)
You should configure `ImportSourceFactory` in your service provider(`register` method)
```
use Matchish\ScoutElasticSearch\Searchable\ImportSourceFactory;
...
public function register(): void
{
$this->app->bind(ImportSourceFactory::class, MyImportSourceFactory::class);
```
Here an example of `MyImportSourceFactory`
Here is an example of `MyImportSourceFactory`
```
namespace Matchish\ScoutElasticSearch\Searchable;
final class MyImportSourceFactory implements ImportSourceFactory
{
public static function from(string $className): ImportSource
{
//Add all required scopes
return new DefaultImportSource($className, [new WithCommentsScope()]);
}
}
Expand Down

0 comments on commit 6bda7b8

Please sign in to comment.