8
8
use Magento \Catalog \Api \Data \ProductInterface ;
9
9
use Magento \Catalog \Model \Product ;
10
10
use Magento \Catalog \Model \ResourceModel \Eav \Attribute ;
11
+ use Magento \CatalogSearch \Model \Search \FilterMapper \VisibilityFilter ;
11
12
use Magento \CatalogSearch \Model \Search \TableMapper ;
13
+ use Magento \Customer \Model \Session ;
12
14
use Magento \Eav \Model \Config ;
13
15
use Magento \Framework \App \Config \ScopeConfigInterface ;
14
16
use Magento \Framework \App \ObjectManager ;
20
22
use Magento \Framework \Search \Adapter \Mysql \Filter \PreprocessorInterface ;
21
23
use Magento \Framework \Search \Request \FilterInterface ;
22
24
use Magento \Store \Model \Store ;
23
- use Magento \Customer \Model \Session ;
24
- use Magento \CatalogSearch \Model \Search \FilterMapper \VisibilityFilter ;
25
25
26
26
/**
27
+ * ElasticSearch search filter pre-processor.
28
+ *
29
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
27
30
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28
31
* @deprecated
29
32
* @see \Magento\ElasticSearch
@@ -128,18 +131,21 @@ public function __construct(
128
131
}
129
132
130
133
/**
131
- * { @inheritdoc}
134
+ * @inheritdoc
132
135
*/
133
136
public function process (FilterInterface $ filter , $ isNegation , $ query )
134
137
{
135
138
return $ this ->processQueryWithField ($ filter , $ isNegation , $ query );
136
139
}
137
140
138
141
/**
142
+ * Process query with field.
143
+ *
139
144
* @param FilterInterface $filter
140
145
* @param bool $isNegation
141
146
* @param string $query
142
147
* @return string
148
+ * @throws \Magento\Framework\Exception\LocalizedException
143
149
*/
144
150
private function processQueryWithField (FilterInterface $ filter , $ isNegation , $ query )
145
151
{
@@ -204,19 +210,23 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
204
210
->where ('main_table.store_id = ? ' , Store::DEFAULT_STORE_ID )
205
211
->having ($ query );
206
212
207
- $ resultQuery = 'search_index.entity_id IN (
208
- select entity_id from ' . $ this ->conditionManager ->wrapBrackets ($ select ) . ' as filter
209
- ) ' ;
213
+ $ resultQuery = 'search_index.entity_id IN ( '
214
+ . 'select entity_id from '
215
+ . $ this ->conditionManager ->wrapBrackets ($ select )
216
+ . ' as filter) ' ;
210
217
}
211
218
212
219
return $ resultQuery ;
213
220
}
214
221
215
222
/**
223
+ * Process range numeric.
224
+ *
216
225
* @param FilterInterface $filter
217
226
* @param string $query
218
227
* @param Attribute $attribute
219
228
* @return string
229
+ * @throws \Exception
220
230
*/
221
231
private function processRangeNumeric (FilterInterface $ filter , $ query , $ attribute )
222
232
{
@@ -238,14 +248,17 @@ private function processRangeNumeric(FilterInterface $filter, $query, $attribute
238
248
->where ('main_table.store_id = ? ' , $ currentStoreId )
239
249
->having ($ query );
240
250
241
- $ resultQuery = 'search_index.entity_id IN (
242
- select entity_id from ' . $ this ->conditionManager ->wrapBrackets ($ select ) . ' as filter
243
- ) ' ;
251
+ $ resultQuery = 'search_index.entity_id IN ( '
252
+ . 'select entity_id from '
253
+ . $ this ->conditionManager ->wrapBrackets ($ select )
254
+ . ' as filter) ' ;
244
255
245
256
return $ resultQuery ;
246
257
}
247
258
248
259
/**
260
+ * Process term select.
261
+ *
249
262
* @param FilterInterface $filter
250
263
* @param bool $isNegation
251
264
* @return string
0 commit comments