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..1b05152903aa9 --- /dev/null +++ b/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php @@ -0,0 +1,46 @@ +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 c02c3034af524..0e328014da0d8 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -11,6 +11,7 @@ "magento/module-eav": "100.2.*", "magento/module-backend": "100.2.*", "magento/module-theme": "100.2.*", + "magento/module-ui": "100.2.*", "magento/module-catalog-inventory": "100.2.*", "magento/framework": "100.2.*" }, 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..449fd13cb575e --- /dev/null +++ b/app/code/Magento/CatalogSearch/view/adminhtml/ui_component/product_listing.xml @@ -0,0 +1,12 @@ + + ++ + + +