Skip to content

Commit 525084e

Browse files
committed
TASK: Document the asset content extraction feature
1 parent 1d8141a commit 525084e

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ For more information on Elasticsearch's Date Formats,
358358

359359
### Working with Assets / Attachments
360360

361-
If you want to index attachments, you need to install the [Elasticsearch Attachment Plugin](https://github.com/elastic/elasticsearch-mapper-attachments).
361+
If you want to index attachments, you need to install the [Elasticsearch Ingest-Attachment Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest-attachment.html).
362362
Then, you can add the following to your `Settings.yaml`:
363363

364364
```yaml
@@ -368,15 +368,33 @@ Neos:
368368
defaultConfigurationPerType:
369369
'Neos\Media\Domain\Model\Asset':
370370
elasticSearchMapping:
371-
type: attachment
372-
indexing: ${Indexing.indexAsset(value)}
371+
type: text
372+
indexing: ${Indexing.Indexing.extractAssetContent(value)}
373+
```
373374

374-
'array<Neos\Media\Domain\Model\Asset>':
375-
elasticSearchMapping:
376-
type: attachment
377-
indexing: ${Indexing.indexAsset(value)}
375+
or add the attachments content to a fulletxt field in your NodeType configuration:
376+
377+
```yaml
378+
properties:
379+
file:
380+
type: 'Neos\Media\Domain\Model\Asset'
381+
ui:
382+
search:
383+
fulltextExtractor: ${Indexing.extractInto('text', Indexing.extractAssetContent(value))}
378384
```
379385

386+
By default `Indexing.extractAssetContent(value)` returns the asset content. You can use the second parameter to return asset meta data. The field parameter can be set to one of the following: `content, title, name, author, keywords, date, content_type, content_length, language`.
387+
388+
With that, you can for example add the keywords of a file to a higher boosted field:
389+
390+
```yaml
391+
properties:
392+
file:
393+
type: 'Neos\Media\Domain\Model\Asset'
394+
ui:
395+
search:
396+
fulltextExtractor: ${Indexing.extractInto('h2', Indexing.extractAssetContent(value, 'keywords'))}
397+
```
380398

381399

382400
# Query Data

0 commit comments

Comments
 (0)