hello, I would like to add custom search according to Add custom data to the search | Shopware Documentation
However, I feel like this guide has a lot of mistakes…
I added code like below
const { Application } = Shopware;
Application.addServiceProviderDecorator('searchTypeService', searchTypeService => {
searchTypeService.upsertType('test', {
entityName: 'test',
placeholderSnippet: 'foo-bar.general.placeholderSearchBar',
listingRoute: 'test',
hideOnGlobalSearchBar: false,
});
return searchTypeService;
});
but when I try find something I get error „Can not get module by the entity name is test“ why? what I must do more ? Entity test exist and working.
I tried creating a new module… but what I need to type in decorator ?
searchTypeService.upsertType('test', {
entityName: 'test',
My new module:
Shopware.Module.register('test', {
entity: 'test',
defaultSearchConfiguration: {
_searchable: true,
name: {
_searchable: true,
_score: 500,
},
description: {
name: {
_searchable: true,
_score: 500,
},
},
},
});
and my decorator
const { Application } = Shopware;
**import '../module/test/index'** // my module import
Application.addServiceProviderDecorator('searchTypeService', searchTypeService => {
searchTypeService.upsertType('test', {
entityName: 'test',
placeholderSnippet: 'test',
listingRoute: 'test',
hideOnGlobalSearchBar: false,
});
return searchTypeService;
});
{imported module and using}
nothing changes, it same error.
main.js
import './decorator/searchTypeServiceDecorator'
structure
where is the problem ?