Skip to content

Commit 4b068af

Browse files
ENGCOM-5402: 23424: fixed search with 0 #23427
- Merge Pull Request #23427 from jeysmook/magento2:23424_search_with_0 - Merged commits: 1. 36190fb 2. a8f5c0d 3. dfd664e
2 parents 44648f0 + dfd664e commit 4b068af

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\CatalogSearch\Ui\DataProvider\Product;
77

8-
use Magento\Framework\Data\Collection;
98
use Magento\CatalogSearch\Model\ResourceModel\Search\Collection as SearchCollection;
9+
use Magento\Framework\Data\Collection;
1010
use Magento\Ui\DataProvider\AddFilterToCollectionInterface;
1111

1212
/**
@@ -30,14 +30,14 @@ public function __construct(SearchCollection $searchCollection)
3030
}
3131

3232
/**
33-
* {@inheritdoc}
33+
* @inheritdoc
3434
*
3535
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3636
*/
3737
public function addFilter(Collection $collection, $field, $condition = null)
3838
{
3939
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
40-
if (isset($condition['fulltext']) && !empty($condition['fulltext'])) {
40+
if (isset($condition['fulltext']) && (string)$condition['fulltext'] !== '') {
4141
$this->searchCollection->addBackendSearchFilter($condition['fulltext']);
4242
$productIds = $this->searchCollection->load()->getAllIds();
4343
$collection->addIdFilter($productIds);

app/code/Magento/Ui/Component/Filters/Type/Search.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Ui\Component\Filters\Type;
77

88
/**
9+
* Class Search
10+
*
911
* @api
1012
* @since 100.0.2
1113
*/
@@ -34,7 +36,7 @@ protected function applyFilter()
3436
{
3537
$value = $this->getContext()->getRequestParam('search');
3638

37-
if ($value) {
39+
if ((string)$value !== '') {
3840
$filter = $this->filterBuilder->setConditionType('fulltext')
3941
->setField($this->getName())
4042
->setValue($value)

0 commit comments

Comments
 (0)