From 1b8753c43c55316fd2c61c688b8d7180beac8ab1 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 16 Feb 2021 14:56:21 +0100 Subject: [PATCH 1/3] Add env configruation to the docs (#547) --- Resources/doc/installation.md | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Resources/doc/installation.md b/Resources/doc/installation.md index 1c9eabe29..5d8532b68 100644 --- a/Resources/doc/installation.md +++ b/Resources/doc/installation.md @@ -16,23 +16,26 @@ composer require sulu/article-bundle ```yml # config/packages/sulu_article.yaml +sulu_article: + index_name: '%env(resolve:ELASTICSEARCH_INDEX)%' + hosts: + - '%env(resolve:ELASTICSEARCH_HOST)%' + types: + article: + translation_key: "sulu_article.article" + sulu_route: mappings: Sulu\Bundle\ArticleBundle\Document\ArticleDocument: - generator: "schema" + generator: schema options: - route_schema: "/articles/{object.getTitle()}" + route_schema: '/articles/{object.getTitle()}' Sulu\Bundle\ArticleBundle\Document\ArticlePageDocument: - generator: "article_page" + generator: article_page options: - route_schema: "/{translator.trans(\"page\")}-{object.getPageNumber()}" - parent: "{object.getParent().getRoutePath()}" + route_schema: '{translator.trans("page")}-{object.getPageNumber()}' + parent: '{object.getParent().getRoutePath()}' -sulu_article: - index_name: su_articles - hosts: ['127.0.0.1:9200'] - -# config/packages/ongr_elasticsearch.yaml ongr_elasticsearch: analysis: tokenizer: @@ -43,6 +46,17 @@ ongr_elasticsearch: tokenizer: pathTokenizer ``` +### Create env variables + +As the elasticsearch index and host could be different between system we create +environment variables for them. + +``` +# .env +ELASTICSEARCH_HOST=127.0.0.1:9200 +ELASTICSEARCH_INDEX=su_myproject +``` + ### Configure the routing ```yml From e8fcd483b9de9b39a0acc6cc8374bf01c1e855ef Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 16 Feb 2021 15:42:35 +0100 Subject: [PATCH 2/3] Add single_article_selection to content type list (#548) --- Resources/doc/content-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/doc/content-types.md b/Resources/doc/content-types.md index 12e334f6f..9c73a466a 100644 --- a/Resources/doc/content-types.md +++ b/Resources/doc/content-types.md @@ -2,7 +2,7 @@ The SuluArticleBundle provides 3 ways to include articles into another page (or article). -1. Direct assignment: `article_selection` +1. Direct assignment: `article_selection` or `single_article_selection` 2. Smart-Content: `articles` or `articles_page_tree` 2. Teaser-Selection: `article` From e86aac493bfdbb9a046650d4943e354d0ee934ae Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 25 Feb 2021 11:48:29 +0100 Subject: [PATCH 3/3] Add required part about creating your documents (#549) --- Resources/doc/article-view-document.md | 51 ++++++++++++++++---------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/Resources/doc/article-view-document.md b/Resources/doc/article-view-document.md index fdadd0207..12f614204 100644 --- a/Resources/doc/article-view-document.md +++ b/Resources/doc/article-view-document.md @@ -36,6 +36,37 @@ The `content` and `view` property is represented by a proxy to avoid resolving d To extend the indexed data you can extend the `ArticleViewDocument`. This can be achieved by performing the following steps. The same steps can also be used to extend the `ArticlePageViewObject`. +### 0. Create a Bundle Class + +Unfortunately, the ElasticsearchBundle allows to overwrite document classes only if an `AppBundle` is registered in the +application. If you do not have registered such a bundle yet, you need to add it to your `src` directory and enable it +in the `config/bundles.php` file. + +```php + ['all' => true], +] +``` + #### 1. Create custom class ```php @@ -125,23 +156,3 @@ class ArticleIndexListener ``` - -### Troubleshooting - -Unfortunately, the ElasticsearchBundle allows to overwrite document classes only if an `AppBundle` is registered in the -application. If you do not have registered such a bundle yet, you need to add it to your `src` directory and enable it -in the `config/bundles.php` file. - -``` -