Skip to content
Romain Ruaud edited this page Jul 18, 2023 · 6 revisions

Frequently Asked Questions

I'm using Fastly and I can't see anything on the Elasticsuite > Search Usage dashboard

If the dashboard is nearly empty and all you can see is a message saying tracking_log_session index does not exist yet. Make sure everything is reindexed, you might be affected by the following issue.

The problem is the Fastly Image Optimization feature, as it detects h.png as an image and removes the parameters from the request.

The solution is to add a custom Fastly VCL in the "vcl_recv" removing the faslty header :

if (req.url ~ "/elasticsuite/tracker/hit/image(/.*)?$") { set req.http.X-Fastly-Imageopto-Api = "none"; return (pass); }

Please also check the next point that can occur in Magento cloud.

I'm on Magento Cloud and can't see anything on the Elasticsuite > Search Usage dashboard

First, check the above point on Fastly.

If after this, you're still having the "tracking_log_session index does not exist yet", you should ask the Adobe Cloud team to add the following lines in the /etc/opensearch/opensearch.yml file :

script.allowed_types: inline 
script.allowed_contexts: search,update,aggs

I have a PHP Fatal error on catalog/search page ?

If you encounters the following error :

Call to undefined method Magento\Catalog\Model\ResourceModel\Product\Collection\Interceptor::addIsInStockFilter() in ../vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php on line 56

or

Call to undefined method Magento\Catalog\Model\ResourceModel\Product\Collection\Interceptor::addSortFilterParameters() in ../vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php:78

This is due to the fact that the Product Collection getting catched by the Interceptor is not an "ElasticSuite Product Collection".

This can be due to several causes :

  • the configuration is not set properly to use ElasticSuite as search engine. You can verify that the following parameter is correctly set : Stores > Configuration > Catalog > Catalog Search > Search Engine.

  • a third party module may cause troubles by overriding the Catalog Product Collection. Please try to deactivate any third party module to find which one is causing trouble. You should look for refrences to \Magento\Catalog\Model\ResourceModel\Product\Collection or Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection in the di.xml files to see who is replacing this one.

  • a third party module is using unclean piece of code involving the Catalog Layer. This has been proven to be the case with Infortis Ultimo theme.

The layer should not be used to call directly the prepareProductCollection method with a side-way created Product Collection.

Wrong Usage :

$collection = $category->getProductCollection();
....

$this->_categoryLayerFactory
        ->create()
        ->prepareProductCollection($collection);

Which should be corrected to :

$collection = $this->_categoryLayerFactory
    ->create()
    ->setCurrentCategory($category)
    ->getProductCollection(); // The getProductCollection method calls the prepareProductCollection() internally

Another wrong example :

// $collectionFactory is a Magento\Catalog\Model\ResourceModel\Product\CollectionFactory

$collection = $layer->prepareProductCollection($collectionFactory->create())

A correct example of call could also be :

// $collectionFactory must be a Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory

$collection = $layer->prepareProductCollection($collectionFactory->create())

I have problems with the pagination / sorting

This is a common problem which also occurs on Magento's native implementation.

This problem is mainly due to the fact that the pagination/sorting does not work anymore if you are doing the following things :

  • you have a layout which is moving the product_list_toolbar block outside the ListProduct block.
  • you have a layout which is removing the product_list_toolbar.
  • you have a layout which is rendering the layered navigation blocks before the product listing.

You can also check for the issue on the Magento2's tracker : https://github.com/magento/magento2/issues/7253

The autocomplete box is not showing up / does only display search terms.

This one can occurs when using custom theme or third party modules :

  • your third party module is removing the header-wrapper block. This has been proven to be the case with the Infortis Ultimo theme and a workardound has been discussed in this issue : https://github.com/Smile-SA/elasticsuite/issues/297

  • you are using a custom theme which is overriding the form.mini.phtml template. ElasticSuite is doing the same. You will have to mixin the two templates files in a custom module :

In a new custom module:

app/code/Vendor/ModuleName/view/frontend/layout/default.xml:

<body>
    <referenceContainer name="header-wrapper">
        <block class="Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete" name="top.search" as="topSearch" template="Vendor_Module::search/form.mini.phtml"/>
    </referenceContainer>
</body>

And then copy (and modify) the template /vendor/smile/elasticsuite/src/module-elasticsuite-core/view/frontend/templates/search/form.mini.phtml to /app/code/Vendor/Module/view/frontend/templates/search/form.mini.phtml

Also, to ensure loads in the right order, include in your /app/code/Vendor/Module/etc/module.xml file:

<module name="Vendor_Module" setup_version="1.0.0">
    <sequence>
        <module name="Smile_ElasticsuiteCore"/>
    </sequence>
</module>

Beware, this means that each time you will install a new Elasticsuite version, you will have to report the modification we made to the form.mini.phtml to yours if needed.

Removing the extension breaks Magento

You may want to see the Uninstalling the module properly page to figure out how to fix it.

Clone this wiki locally