Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search index configuration #480

Open
mgwestwerk opened this issue May 20, 2020 · 1 comment
Open

Add search index configuration #480

mgwestwerk opened this issue May 20, 2020 · 1 comment

Comments

@mgwestwerk
Copy link

mgwestwerk commented May 20, 2020

Q A
Bug? no
New Feature? yes
SuluArticleBundle Version 2.0
Sulu Version 2.0.6

Actual Behavior

Articles do not appear in search results provided by the SearchBundle.

Expected Behavior

Articles should be among the possible search results.

Possible Solutions

Prepend for the article index to the sulu_search configuration

Related Issues

sulu/sulu#2811 is necessary in order to include articles in frontend searches
#468 to support multiple article types

@niklasnatter
Copy link
Contributor

niklasnatter commented Apr 6, 2021

Just stumbled upon this again and want to add some context here. In theor, solving this hould be as easy as adding the following lines to the SuluArticleExtension:

$container->prependExtensionConfig(
    'sulu_search',
    [
        'indexes' => [
            'article' => [
                'name' => 'sulu_article.articles',
                'icon' => 'su-newspaper',
                'view' => [
                    'name' => ArticleAdmin::EDIT_FORM_VIEW,
                    'result_to_view' => ['id' => 'id', 'locale' => 'locale'],
                ],
                'security_context' => ArticleAdmin::SECURITY_CONTEXT,
            ],
        ],
    ]
);

Unfortunately, this does not work because the ArticleAdmin::EDIT_FORM_VIEW is not registered as view. Instead, the bundle registers a separate EDIT_FORM_VIEW for each article type:

$viewCollection->add(
$this->viewBuilderFactory->createResourceTabViewBuilder(static::EDIT_FORM_VIEW . '_' . $typeKey, '/articles/:locale/' . $typeKey . '/:id')
->setResourceKey('articles')
->addLocales($locales)
->setBackView(static::LIST_VIEW . '_' . $typeKey)
->setTitleProperty('title')
);

This problem is similar to the problem that prevents the implementation of deep links in the bundle at the moment: #468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants