Skip to content

Commit

Permalink
Deprecate separate search tag methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Sep 17, 2024
1 parent c6cf71f commit d2d5c8f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions classes/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,10 @@ protected static function saveIndex(&$queryArray3)
$queryArray3 = [];
}

/**
* @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
* is already included in Search::find method. Tags are indexed for each product.
*/
public static function searchTag(
$id_lang,
$tag,
Expand Down
7 changes: 7 additions & 0 deletions controllers/front/listing/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ public function init()
$this->search_string = Tools::getValue('search_query');
}

// @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
// is already included in Search::find method. Tags are indexed for each product.
$this->search_tag = Tools::getValue('tag');

$this->context->smarty->assign(
[
'search_string' => $this->search_string,
// @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
// is already included in Search::find method. Tags are indexed for each product.
'search_tag' => $this->search_tag,
// @deprecated since 8.2.0 and will be removed in 9.0.0, unused
'subcategories' => [],
]
);
Expand Down Expand Up @@ -99,6 +104,8 @@ protected function getProductSearchQuery()
->setQueryType('search')
->setSortOrder(new SortOrder('product', 'position', 'desc'))
->setSearchString($this->search_string)
// @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
// is already included in Search::find method. Tags are indexed for each product.
->setSearchTag($this->search_tag);

return $query;
Expand Down
6 changes: 4 additions & 2 deletions src/Adapter/Search/SearchProductSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ public function runQuery(
'searched_query' => $queryString,
'total' => $count,

// deprecated since 1.7.x
// @deprecated since 1.7.x and will be removed in 9.0.0
'expr' => $queryString,
]);
} elseif (($tag = $query->getSearchTag())) {
// @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
// is already included in Search::find method. Tags are indexed for each product.
$queryString = urldecode($tag);

$products = Search::searchTag(
Expand Down Expand Up @@ -119,7 +121,7 @@ public function runQuery(
'searched_query' => $queryString,
'total' => $count,

// deprecated since 1.7.x
// @deprecated since 1.7.x and will be removed in 9.0.0
'expr' => $queryString,
]);
}
Expand Down
9 changes: 9 additions & 0 deletions src/Core/Product/Search/ProductSearchQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class ProductSearchQuery
private $searchString;

/**
* @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
* is already included in Search::find method. Tags are indexed for each product.
*
* @var string
*/
private $searchTag;
Expand Down Expand Up @@ -253,6 +256,9 @@ public function getSearchString()
}

/**
* @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
* is already included in Search::find method. Tags are indexed for each product.
*
* @param string $searchTag
*
* @return $this
Expand All @@ -265,6 +271,9 @@ public function setSearchTag($searchTag)
}

/**
* @deprecated since 8.2.0 and will be removed in 9.0.0, searching products by tags
* is already included in Search::find method. Tags are indexed for each product.
*
* @return string
*/
public function getSearchTag()
Expand Down

0 comments on commit d2d5c8f

Please sign in to comment.