Very slow Product collection load

I have a custom product collection that takes about 120 sec to load. How can I fix this? I’m posting the functions related to collection (not the whole module code): Mymodule/Block/Products/Category.php /* ….. */ public function getProductCollection($category) { $collection = $this->_productCollectionFactory->create(); $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds()); if($category->getId()){ if ($category->hasChildren()) { $categoryFilter = explode(‘,’,$category->getAllChildren()); } else { $categoryFilter = $category->getId();…

Details

insert a line into xml using xmlstarlet

I have an XML file which looks like so: <?xml version=”1.0″ encoding=”UTF-8″?> <!– Solr managed schema – automatically generated – DO NOT EDIT –> <schema name=”default-config” version=”1.6″> <uniqueKey>id</uniqueKey> …. I would like to insert this line: <similarity class=”solr.BM25SimilarityFactory”/> between <schema.. and <uniqueKey like so: <?xml version=”1.0″ encoding=”UTF-8″?> <!– Solr managed schema – automatically generated -…

Details