1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Spryker Commerce OS. |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
declare(strict_types = 1); |
9
|
|
|
|
10
|
|
|
namespace Pyz\Client\CmsPageSearch; |
11
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\SearchContextTransfer; |
13
|
|
|
use Spryker\Client\CmsPageSearch\CmsPageSearchConfig; |
14
|
|
|
use Spryker\Client\CmsPageSearch\CmsPageSearchDependencyProvider as SprykerCmsPageSearchDependencyProvider; |
15
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\Query\CmsPageSearchQueryPlugin; |
16
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\QueryExpander\PaginatedCmsPageQueryExpanderPlugin; |
17
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\QueryExpander\SortedCmsPageQueryExpanderPlugin; |
18
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\ResultFormatter\PaginatedCmsPageResultFormatterPlugin; |
19
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\ResultFormatter\RawCmsPageSearchResultFormatterPlugin; |
20
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\ResultFormatter\SortedCmsPageSearchResultFormatterPlugin; |
21
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Elasticsearch\SearchResultCount\SearchElasticSearchResultCountPlugin; |
22
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Search\SearchHttp\ResultFormatter\CmsPageSearchHttpResultFormatterPlugin; |
23
|
|
|
use Spryker\Client\CmsPageSearch\Plugin\Search\SearchHttp\ResultFormatter\CmsPageSortSearchHttpResultFormatterPlugin; |
24
|
|
|
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveInDateRangeQueryExpanderPlugin; |
25
|
|
|
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveQueryExpanderPlugin; |
26
|
|
|
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\LocalizedQueryExpanderPlugin; |
27
|
|
|
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\StoreQueryExpanderPlugin; |
28
|
|
|
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SearchHttpQueryPlugin; |
29
|
|
|
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\BasicSearchHttpQueryExpanderPlugin; |
30
|
|
|
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\FacetSearchHttpQueryExpanderPlugin; |
31
|
|
|
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\FacetSearchHttpResultFormatterPlugin; |
32
|
|
|
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\PaginationSearchHttpResultFormatterPlugin; |
33
|
|
|
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchResultCountPlugin; |
34
|
|
|
|
35
|
|
|
class CmsPageSearchDependencyProvider extends SprykerCmsPageSearchDependencyProvider |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* @return array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface> |
39
|
|
|
*/ |
40
|
|
|
protected function createCmsPageSearchQueryExpanderPlugins(): array |
41
|
|
|
{ |
42
|
|
|
return [ |
43
|
|
|
new StoreQueryExpanderPlugin(), |
44
|
|
|
new LocalizedQueryExpanderPlugin(), |
45
|
|
|
new SortedCmsPageQueryExpanderPlugin(), |
46
|
|
|
new PaginatedCmsPageQueryExpanderPlugin(), |
47
|
|
|
new IsActiveQueryExpanderPlugin(), |
48
|
|
|
new IsActiveInDateRangeQueryExpanderPlugin(), |
49
|
|
|
]; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface> |
54
|
|
|
* |
55
|
|
|
* @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface>|array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface> |
56
|
|
|
*/ |
57
|
|
|
protected function createCmsPageSearchResultFormatterPlugins(): array |
58
|
|
|
{ |
59
|
|
|
return [ |
60
|
|
|
new SortedCmsPageSearchResultFormatterPlugin(), |
61
|
|
|
new PaginatedCmsPageResultFormatterPlugin(), |
62
|
|
|
new RawCmsPageSearchResultFormatterPlugin(), |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface> |
68
|
|
|
*/ |
69
|
|
|
protected function createCmsPageSearchCountQueryExpanderPlugins(): array |
70
|
|
|
{ |
71
|
|
|
return [ |
72
|
|
|
new StoreQueryExpanderPlugin(), |
73
|
|
|
new LocalizedQueryExpanderPlugin(), |
74
|
|
|
new IsActiveQueryExpanderPlugin(), |
75
|
|
|
new IsActiveInDateRangeQueryExpanderPlugin(), |
76
|
|
|
]; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface> |
81
|
|
|
*/ |
82
|
|
|
protected function getCmsPageHttpSearchQueryExpanderPlugins(): array |
83
|
|
|
{ |
84
|
|
|
return [ |
85
|
|
|
new BasicSearchHttpQueryExpanderPlugin(), |
86
|
|
|
new FacetSearchHttpQueryExpanderPlugin(), |
87
|
|
|
]; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface> |
92
|
|
|
*/ |
93
|
|
|
protected function getCmsPageHttpSearchResultFormatterPlugins(): array |
94
|
|
|
{ |
95
|
|
|
return [ |
96
|
|
|
new PaginationSearchHttpResultFormatterPlugin(), |
97
|
|
|
new CmsPageSortSearchHttpResultFormatterPlugin(), |
98
|
|
|
new CmsPageSearchHttpResultFormatterPlugin(), |
99
|
|
|
new FacetSearchHttpResultFormatterPlugin(), |
100
|
|
|
]; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface> |
105
|
|
|
*/ |
106
|
|
|
protected function getCmsPageSearchQueryPlugins(): array |
107
|
|
|
{ |
108
|
|
|
/** @var array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface> $plugins */ |
109
|
|
|
$plugins = [ |
110
|
|
|
new SearchHttpQueryPlugin( |
111
|
|
|
(new SearchContextTransfer()) |
112
|
|
|
->setSourceIdentifier(CmsPageSearchConfig::SOURCE_IDENTIFIER_CMS_PAGE), |
113
|
|
|
), |
114
|
|
|
new CmsPageSearchQueryPlugin(), |
115
|
|
|
]; |
116
|
|
|
|
117
|
|
|
return $plugins; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\SearchResultCountPluginInterface> |
122
|
|
|
*/ |
123
|
|
|
protected function getCmsPageSearchResultCountPlugins(): array |
124
|
|
|
{ |
125
|
|
|
return [ |
126
|
|
|
CmsPageSearchConfig::SEARCH_STRATEGY_SEARCH_HTTP => new SearchHttpSearchResultCountPlugin(), |
127
|
|
|
CmsPageSearchConfig::SEARCH_STRATEGY_ELASTICSEARCH => new SearchElasticSearchResultCountPlugin(), |
128
|
|
|
]; |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|