Skip to content

Commit

Permalink
Add fake elasticsearch checker
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Jul 27, 2023
1 parent 2aa66bd commit 7968ab9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- New method `deleteByDocumentIds` in the `MonsieurBiz\SyliusSearchPlugin\Index\IndexerInterface` interface
- Deprecated the method `deleteByDocuments` in the `MonsieurBiz\SyliusSearchPlugin\Index\IndexerInterface` interface. Use `deleteByDocumentIds` instead.
- `ChannelFilter` and `EnabledFilter` in `MonsieurBiz\SyliusSearchPlugin\Search\Request\QueryFilter\Product` were moved to `MonsieurBiz\SyliusSearchPlugin\Search\Request\QueryFilter`
- A fallback on the Sylius' taxon display is now used to keep your pages even if you Elasticsearch instance is down. If you want to disable it, check the [FakeElasticsearchChecker](docs/disable_elasticsearch_checker.md)

# UPGRADE FROM v1.X.X TO v2.0.x

Expand Down
11 changes: 11 additions & 0 deletions docs/disable_elasticsearch_checker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Disable the ElasticsearchChecker

The plugin now checks if the Elasticsearch server is running before each search.

If you want to disable this feature, you can do it by adding the following configuration:

```yaml
services:
monsieurbiz.search.checker.elasticsearch_checker:
class: MonsieurBiz\SyliusSearchPlugin\Checker\FakeElasticsearchChecker
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Menu

- [Disable the ElasticsearchChecker](./disable_elasticsearch_checker.md)
- [Add custom sorts](./add_custom_sorts.md)
- [Add custom values for an entity](./add_custom_values.md)
- [Add custom filters](./add_custom_filters.md)
Expand Down
22 changes: 22 additions & 0 deletions src/Checker/FakeElasticsearchChecker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of Monsieur Biz' Search plugin for Sylius.
*
* (c) Monsieur Biz <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace MonsieurBiz\SyliusSearchPlugin\Checker;

class FakeElasticsearchChecker implements ElasticsearchCheckerInterface
{
public function check(): bool
{
return true;
}
}

0 comments on commit 7968ab9

Please sign in to comment.