Skip to content

Commit 7cf4685

Browse files
committed
frontend API: removed searching in products based on brand, category or flag query
- YAGNI violation
1 parent 1e5ecc0 commit 7cf4685

4 files changed

Lines changed: 0 additions & 25 deletions

File tree

src/Model/Product/Filter/ProductFilterConfigFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,15 @@ public function __construct(
4040
/**
4141
* @param string $locale
4242
* @param \Shopsys\FrameworkBundle\Model\Category\Category $category
43-
* @param string $searchText
4443
* @return \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfig
4544
*/
4645
public function createForCategory(
4746
string $locale,
4847
Category $category,
49-
string $searchText,
5048
): ProductFilterConfig {
5149
$productFilterConfigIdsData = $this->productFilterElasticFacade->getProductFilterDataInCategory(
5250
$category->getId(),
5351
$this->currentCustomerUser->getPricingGroup(),
54-
$searchText,
5552
);
5653

5754
$aggregatedParameterFilterChoices = $this->parameterFacade->getParameterFilterChoicesByIds(

src/Model/Product/Filter/ProductFilterElasticFacade.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,16 @@ public function __construct(
2525
/**
2626
* @param int $categoryId
2727
* @param \Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroup $pricingGroup
28-
* @param string $search
2928
* @return \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfigIdsData
3029
*/
3130
public function getProductFilterDataInCategory(
3231
int $categoryId,
3332
PricingGroup $pricingGroup,
34-
string $search,
3533
): ProductFilterConfigIdsData {
3634
$filterQuery = $this->filterQueryFactory->createVisible()
3735
->filterOnlySellable()
3836
->filterByCategory([$categoryId]);
3937

40-
if ($search !== '') {
41-
$filterQuery = $filterQuery->search($search);
42-
}
4338
$aggregationQuery = $filterQuery
4439
->getAggregationQueryForProductFilterConfig($pricingGroup->getId());
4540
$aggregationResult = $this->client->search($aggregationQuery)['aggregations'];
@@ -68,21 +63,16 @@ public function getProductFilterDataForSearch(
6863
/**
6964
* @param int $brandId
7065
* @param \Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroup $pricingGroup
71-
* @param string $searchText
7266
* @return \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfigIdsData
7367
*/
7468
public function getProductFilterDataInBrand(
7569
int $brandId,
7670
PricingGroup $pricingGroup,
77-
string $searchText = '',
7871
): ProductFilterConfigIdsData {
7972
$filterQuery = $this->filterQueryFactory->createVisible()
8073
->filterOnlySellable()
8174
->filterByBrands([$brandId]);
8275

83-
if ($searchText !== '') {
84-
$filterQuery = $filterQuery->search($searchText);
85-
}
8676
$aggregationQuery = $filterQuery
8777
->getAggregationQueryForProductFilterConfig($pricingGroup->getId());
8878
$aggregationResult = $this->client->search($aggregationQuery)['aggregations'];
@@ -93,21 +83,16 @@ public function getProductFilterDataInBrand(
9383
/**
9484
* @param int $flagId
9585
* @param \Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroup $pricingGroup
96-
* @param string $searchText
9786
* @return \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfigIdsData
9887
*/
9988
public function getProductFilterDataInFlag(
10089
int $flagId,
10190
PricingGroup $pricingGroup,
102-
string $searchText = '',
10391
): ProductFilterConfigIdsData {
10492
$filterQuery = $this->filterQueryFactory->createVisible()
10593
->filterOnlySellable()
10694
->filterByFlags([$flagId]);
10795

108-
if ($searchText !== '') {
109-
$filterQuery = $filterQuery->search($searchText);
110-
}
11196
$aggregationQuery = $filterQuery
11297
->getAggregationQueryForProductFilterConfig($pricingGroup->getId());
11398
$aggregationResult = $this->client->search($aggregationQuery)['aggregations'];

src/Model/Product/ProductOnCurrentDomainElasticFacade.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,12 @@ public function getProductFilterCountDataInCategory(
5555
int $categoryId,
5656
ProductFilterConfig $productFilterConfig,
5757
ProductFilterData $productFilterData,
58-
string $searchText = '',
5958
): ProductFilterCountData {
6059
$baseFilterQuery = $this->filterQueryFactory->createListableProductsByCategoryIdWithPriceAndStockFilter(
6160
$categoryId,
6261
$productFilterData,
6362
);
6463

65-
if ($searchText !== '') {
66-
$baseFilterQuery = $baseFilterQuery->search($searchText);
67-
}
68-
6964
return $this->productFilterCountDataElasticsearchRepository->getProductFilterCountDataInCategory(
7065
$productFilterData,
7166
$baseFilterQuery,

src/Model/Product/ProductOnCurrentDomainFacadeInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ public function getVisibleProductById(int $productId): Product;
2020
* @param int $categoryId
2121
* @param \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfig $productFilterConfig
2222
* @param \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterData $productFilterData
23-
* @param string $searchText
2423
* @return \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterCountData
2524
*/
2625
public function getProductFilterCountDataInCategory(
2726
int $categoryId,
2827
ProductFilterConfig $productFilterConfig,
2928
ProductFilterData $productFilterData,
30-
string $searchText = '',
3129
): ProductFilterCountData;
3230

3331
/**

0 commit comments

Comments
 (0)