Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
spotbot2k committed Sep 24, 2021
1 parent 5ac0554 commit 598382f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The Dynamic Search Bundle allows you to redefine your search strategy. It's base
## Further Information
- [Example Setup](docs/0_ExampleSetup.md)
- [Configuration](#)
- [Context Guard](#)
- [Context Guard](docs/1_Configuration/0_Context Guard.md)
- [Document Definition](#)
- [Logging](#)
- [Data Creation](#)
Expand Down
6 changes: 3 additions & 3 deletions docs/0_ExampleSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
### composer.json
```json
"require" : {
"dachcom-digital/dynamic-search": "~0.7.0",
"dachcom-digital/dynamic-search-data-provider-trinity": "~0.7.0",
"dachcom-digital/dynamic-search-index-provider-lucene": "~0.7.0",
"dachcom-digital/dynamic-search": "~1.0.0",
"dachcom-digital/dynamic-search-data-provider-trinity": "~1.0.0",
"dachcom-digital/dynamic-search-index-provider-lucene": "~1.0.0",
}
```

Expand Down
40 changes: 40 additions & 0 deletions docs/1_Configuration/0_Context Guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Context Guard

The context guard add an additional layer of protection and controll ontop of the set of your indexing rules. It allows you to filter the result and avoid indexing unvanted content.

To implement a guard add a service that would implement `ContextGuardInterface`.

## Example Setup

``` yaml
services:
AppBundle\DynamicSearch\Guard\DefaultContextGuard:
tags:
- { name: dynamic_search.context_guard }
```
This simple guard will prevent the document with the id 1 (it is the root document in the pimcore document tree) to be added to the index.
``` php
<?php

namespace AppBundle\DynamicSearch\Guard;

use DynamicSearchBundle\Guard\ContextGuardInterface;
use DynamicSearchBundle\Normalizer\Resource\ResourceMetaInterface;

class DefaultContextGuard implements ContextGuardInterface
{
/**
* {@inheritDoc}
*/
public function verifyResourceMetaForContext(string $contextName, ResourceMetaInterface $resourceMeta)
{
if ($resourceMeta->getResourceId() > 1) {
return true;
}

return false;
}
}

```

0 comments on commit 598382f

Please sign in to comment.