Undefine factory on custom module
Question
I am using Sphinx Search Extension. it was working good on Magento 2.2.8 version. Now am upgrade my store on 2.3.2 it give error
Undefined factory sphinx
Anyone also face this issue? if then how to resolve it?
Pas de solution correcte
Autres conseils
I don't know how sphinx works, but your search engine requires a factory attached to the Magento\CatalogSearch\Model\Search\ItemCollectionProvider
class.
You can do this via di.xml
of one of your modules (probably the sphinx module itself)
<type name="Magento\CatalogSearch\Model\Search\ItemCollectionProvider">
<arguments>
<argument name="factories" xsi:type="array">
<item name="sphinx" xsi:type="object">class name or virtual type name here</item>
</argument>
</arguments>
</type>
Here is an example on how it works for elasticsearch6.
vendor/magento/module-elasticsearch-6/etc/di.xml
<type name="Magento\CatalogSearch\Model\Search\ItemCollectionProvider">
<arguments>
<argument name="factories" xsi:type="array">
<item name="elasticsearch6" xsi:type="object">elasticsearchAdvancedCollectionFactory</item>
</argument>
</arguments>
</type>
where elasticsearchAdvancedCollectionFactory
is a virtual type defined in vendor/magento/module-elasticsearch/etc/di.xml
<virtualType name="elasticsearchAdvancedCollectionFactory" type="Magento\CatalogSearch\Model\ResourceModel\Advanced\CollectionFactory">
<arguments>
<argument name="instanceName" xsi:type="string">elasticsearchAdvancedCollection</argument>
</arguments>
</virtualType>
where elasticsearchAdvancedCollection
is another virtual type. you can search for it further in di.xml files.