Skip to content

Commit

Permalink
add some doc structure
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Aug 1, 2019
1 parent e92e98f commit 3a52c00
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 14 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ The Dynamic Search Bundle allows you to redefine your search strategy. It's base

## Further Information
- [Example Setup](docs/0_ExampleSetup.md)
- [Context Guard](#)
- [Configuration](#)
- [Context Guard](#)
- [Document Definition](#)
- [Logging](#)
- [Data Creation](#)
- [Enable automatic Update / Insert / Delete Service](#)
- [Data Fetching](#)
- [Output Channels](#)
- [Create Output Channel](#)
- [Multi Search Channels](#)
- [Channel Filter / Actions](#)
- [Filter (Faceted Search / Aggregation)](#)
- [Create Filter Definition](#)
- [API](#)

### Installation via Extension Manager
After you have installed the Dynamic Search Bundle via composer, open pimcore backend and go to `Tools` => `Extension`:
Expand Down
57 changes: 44 additions & 13 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.3.0",
"dachcom-digital/dynamic-search-data-provider-trinity": "~0.3.0",
"dachcom-digital/dynamic-search-index-provider-lucene": "~0.3.0",
"dachcom-digital/dynamic-search": "~0.4.0",
"dachcom-digital/dynamic-search-data-provider-trinity": "~0.4.0",
"dachcom-digital/dynamic-search-index-provider-lucene": "~0.4.0",
}
```

Expand Down Expand Up @@ -53,9 +53,9 @@ dynamic_search:

output_channels:
autocomplete:
service: 'lucene'
service: 'lucene_autocomplete'
suggestions:
service: 'lucene'
service: 'lucene_suggestions'
#options:
# restrict_search_fields:
# - 'sku'
Expand All @@ -64,13 +64,26 @@ dynamic_search:
#options:
# skip_fields: ['title']
search:
service: 'lucene'
options:
max_per_page: 4
service: 'lucene_search'
internal: false
use_frontend_controller: true
paginator:
enabled: true
# adapter_class: ''
max_per_page: 1
normalizer:
service: 'lucene_document_key_value_normalizer'
#options:
# skip_fields: ['title']
multi_search:
multiple: true
service: 'lucene_multi_search'
use_frontend_controller: true
blocks:
type1:
reference: search
type2:
reference: search

```

Expand All @@ -83,6 +96,7 @@ namespace AppBundle\Ds\IndexDefinition\Trinity;
use DynamicSearchBundle\Document\Definition\DocumentDefinitionBuilderInterface;
use DynamicSearchBundle\Document\Definition\DocumentDefinitionInterface;
use DynamicSearchBundle\Normalizer\Resource\ResourceMetaInterface;
use DynamicSearchBundle\Document\Definition\PreProcessedDocumentDefinitionInterface;

class Definition implements DocumentDefinitionBuilderInterface
{
Expand All @@ -104,26 +118,43 @@ class Definition implements DocumentDefinitionBuilderInterface
public function buildDefinition(DocumentDefinitionInterface $definition, array $normalizerOptions)
{
$definition
->addDocumentFieldDefinition([
->addSimpleDocumentFieldDefinition([
'name' => 'sku',
'index_transformer' => [
'type' => 'keyword',
'type' => 'text',
],
'data_transformer' => [
'type' => 'object_getter_extractor',
'configuration' => ['method' => 'getSku']
]
])
->addDocumentFieldDefinition([
->addSimpleDocumentFieldDefinition([
'name' => 'title',
'index_transformer' => [
'type' => 'keyword',
'type' => 'text',
],
'data_transformer' => [
'type' => 'object_getter_extractor',
'configuration' => ['method' => 'getTitle']
]
]);
])
->addPreProcessFieldDefinition([
'type' => 'object_relations_getter_extractor',
'configuration' => [
'relations' => 'categories',
'method' => 'getId',
]
], function (PreProcessedDocumentDefinitionInterface $definition, array $preProcessedTransformedData) {
foreach ($preProcessedTransformedData as $categoryId) {
$definition->addSimpleDocumentFieldDefinition([
'name' => sprintf('category_%d', $categoryId),
'index_transformer' => [
'type' => 'keyword',
],
'value' => '1'
]);
}
});
}
}
```

0 comments on commit 3a52c00

Please sign in to comment.