diff --git a/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php b/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php new file mode 100644 index 0000000000000..d1be68436b675 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php @@ -0,0 +1,47 @@ +searchCollection = $searchCollection; + } + + /** + * {@inheritdoc} + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addFilter(Collection $collection, $field, $condition = null) + { + /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */ + if (isset($condition['fulltext']) && !empty($condition['fulltext'])) { + $this->searchCollection->addBackendSearchFilter($condition['fulltext']); + $productIds = $this->searchCollection->load()->getAllIds(); + $collection->addIdFilter($productIds); + } + } +} diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index e5bca4f85bd2c..a45b30b5c94f1 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -12,6 +12,7 @@ "magento/module-eav": "101.0.*", "magento/module-backend": "100.2.*", "magento/module-theme": "100.2.*", + "magento/module-ui": "101.0.*", "magento/module-catalog-inventory": "100.2.*", "magento/framework": "101.0.*" }, diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml index d323f0e95d9de..7877ff04b24fd 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/di.xml @@ -19,4 +19,11 @@ + + + + Magento\CatalogSearch\Ui\DataProvider\Product\AddFulltextFilterToCollection + + + diff --git a/app/code/Magento/CatalogSearch/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/CatalogSearch/view/adminhtml/ui_component/product_listing.xml new file mode 100644 index 0000000000000..24aa4a8919db8 --- /dev/null +++ b/app/code/Magento/CatalogSearch/view/adminhtml/ui_component/product_listing.xml @@ -0,0 +1,12 @@ + + ++ + + +