diff --git a/main/src/Model/Plugin/AdapterFactoryPlugin.php b/main/src/Model/Plugin/AdapterFactoryPlugin.php
index 2a2bfdf..ea6239d 100755
--- a/main/src/Model/Plugin/AdapterFactoryPlugin.php
+++ b/main/src/Model/Plugin/AdapterFactoryPlugin.php
@@ -56,6 +56,14 @@ class AdapterFactoryPlugin
* @var LoggerInterface
*/
private $logger;
+ /**
+ * @var string[]
+ */
+ private $searchResultModuleNames;
+ /**
+ * @var string[]
+ */
+ private $categoryModuleNames;
/**
* @param ScopeConfigInterface $scopeConfig
@@ -73,7 +81,9 @@ public function __construct(
RequestInterface $request,
AllStoresConfig $solrConfig,
StoreManagerInterface $storeManager,
- LoggerInterface $logger
+ LoggerInterface $logger,
+ array $searchResultModuleNames,
+ array $categoryModuleNames
) {
$this->scopeConfig = $scopeConfig;
$this->registry = $registry;
@@ -82,6 +92,8 @@ public function __construct(
$this->solrResource = new ResourceFacade($solrConfig->getArrayCopy());
$this->storeManager = $storeManager;
$this->logger = $logger;
+ $this->searchResultModuleNames = $searchResultModuleNames;
+ $this->categoryModuleNames = $categoryModuleNames;
}
/**
@@ -95,7 +107,10 @@ public function aroundCreate(AdapterFactory $subject, \Closure $proceed, $data =
if (!$this->scopeConfig->isSetFlag('integernet_solr/general/is_active')) {
return $proceed($data);
}
- if ($this->request->getModuleName() == 'catalog'
+ if (!$this->isCategoryRequest() && !$this->isSearchResultRequest()) {
+ return $proceed($data);
+ }
+ if ($this->isCategoryRequest()
&& !$this->scopeConfig->isSetFlag('integernet_solr/category/is_active')) {
return $proceed($data);
}
@@ -117,4 +132,20 @@ private function canPingSolrServer($storeId)
return boolval($solr->ping());
}
+
+ /**
+ * @return bool
+ */
+ private function isSearchResultRequest()
+ {
+ return in_array($this->request->getModuleName(), $this->searchResultModuleNames);
+ }
+
+ /**
+ * @return bool
+ */
+ private function isCategoryRequest()
+ {
+ return in_array($this->request->getModuleName(), $this->categoryModuleNames);
+ }
}
\ No newline at end of file
diff --git a/main/src/etc/di.xml b/main/src/etc/di.xml
index a4a9f2d..1e8a0e6 100755
--- a/main/src/etc/di.xml
+++ b/main/src/etc/di.xml
@@ -82,6 +82,16 @@
+
+
+
+ - catalogsearch
+
+
+ - catalog
+
+
+