Closed real34 closed 5 years ago
For information, it seems indeed to be a limitation of the format used (if I understand correctly). It struggled to find more information about the merging syntax…
We would need additional ids in https://github.com/Smile-SA/elasticsuite/blob/10e30ee0c4cf0b6734e162dbc1795b384f8210cb/src/module-elasticsuite-core/Index/Indices/Config/Reader.php#L48 (I haven’t found a test case in https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/Config/Test/Unit/DomTest.php that illustrate merging by tag name).
Do you think the only solution would be to add something like <property type="isFilterable">1</property>
?
On my dev environment, the merge appears to be correct.
I have a module ( I did testing directly in another module I have) which is having this module.xml
:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Smile_ElasticsuiteRating" setup_version="1.2.0">
<sequence>
<module name="Smile_ElasticsuiteCore" />
<module name="Smile_ElasticsuiteVirtualCategory" />
<module name="Magento_Search" />
<module name="Magento_Catalog" />
<module name="Magento_CatalogSearch" />
<module name="Magento_LayeredNavigation" />
<module name="Magento_Review" />
</sequence>
</module>
</config>
And this elasticsuite_indices.xml
:
<index identifier="catalog_product" defaultSearchType="product">
<type name="product" idFieldName="entity_id">
<datasources>
<datasource name="rating">Smile\ElasticsuiteRating\Model\Product\Indexer\Fulltext\Datasource\RatingData</datasource>
</datasources>
<mapping>
<field name="ratings_summary" type="double"/>
<field name="category.name" type="text" nestedPath="category">
<isSearchable>1</isSearchable>
<isUsedInSpellcheck>1</isUsedInSpellcheck>
<isFilterable>1</isFilterable>
</field>
</mapping>
</type>
</index>
So it's quite close to your example imho.
If I log $typeConfigData
at this exact line (https://github.com/Smile-SA/elasticsuite/blob/2.7.x/src/module-elasticsuite-core/Index/Indices/Config.php#L121), I have :
...
[category.name] => Array
(
[type] => text
[nestedPath] => category
[fieldConfig] => Array
(
[is_searchable] => 1
[is_used_in_spellcheck] => 1
[is_filterable] => 1
)
)
...
And my mapping is then :
"name": {
"type": "text",
"fields": {
"untouched": {
"type": "keyword"
}
},
"copy_to": [
"search",
"spelling"
],
"analyzer": "standard"
},
Thanks for your answer. I finally could dig deeper… and found my mistake. It was a PEBCAK… :disappointed: everything I wrote above is incorrect.
TL;DR: The following XML works perfectly on 2.3.1:
<?xml version="1.0"?>
<indices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Smile_ElasticsuiteCore:etc/elasticsuite_indices.xsd">
<index identifier="catalog_product" defaultSearchType="product">
<type name="product" idFieldName="entity_id">
<mapping>
<field name="category.name" type="text" nestedPath="category">
<isSearchable>1</isSearchable>
<isUsedInSpellcheck>1</isUsedInSpellcheck>
<isFilterable>1</isFilterable>
</field>
</mapping>
</type>
</index>
</indices>
Sorry for this false alert, and thanks again for your time! You may update the labels to "question" since it was not a bug in the end.
Preconditions
Magento Version : 2.3.0 and 2.3.1
ElasticSuite Version : 2.7.6
Environment : I tried with both
Steps to reproduce
elasticsuite_indices.xml
file in this new module, with the following content:./bin/magento cache:flush && ./bin/magento index:reindex
Expected result
I would like to customize the metadata for the
category.name
field, to change https://github.com/Smile-SA/elasticsuite/blob/10e30ee0c4cf0b6734e162dbc1795b384f8210cb/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml#L68 to1
category.name
field mapping should be:Actual result
category.anothername
is correct though… so it may be related to XML configuration merging.