Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs]Describe how to create and use finder #1886

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions doc/finder.md
@@ -0,0 +1,35 @@
# Finder

The service that enables you to fetch objects from Elasticsearch is called `Finder`.
You can create a custom Finder by implementing the `FinderInterface` interface and map it in config or via Symfony a tag.

Most projects require pagination. To enable paginationt - implement the `PaginatedFinderInterface`.

## Via Symfony tags
```yaml
# config/services.yaml
App\Finder\UserFinder:
class: App\Finder\UserFinder
tags:
- { name: fos_elastica.finder, index: user }
```


## Via config yaml file

```yaml
# config/services.yaml
App\Finder\UserFinder:
class: App\Finder\UserFinder
```

```yaml
# config/packages/fos_elastica.yaml
fos_elastica:
indexes:
user: # Index Name
persistence:
finder:
service: App\Finder\UserFinder

```