<!--
/**
 * Smil_ElasticsuiteCatalog module configuration
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteCatalog
 * @author    Romain RUAUD <romain.ruaud@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="smile_elasticsuite_autocomplete_settings">
            <group id="product_autocomplete" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Product Autocomplete</label>
                <field id="max_size" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Max Size</label>
                    <validate>integer</validate>
                    <comment><![CDATA[Maximum number of products to display in autocomplete results.]]></comment>
                </field>
            </group>
            <group id="product_attribute_autocomplete" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Product Attributes Autocomplete</label>
                <field id="max_size" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Max Size</label>
                    <validate>integer</validate>
                    <comment><![CDATA[Maximum number of product attributes to display in autocomplete results.]]></comment>
                </field>
            </group>
            <group id="category_autocomplete" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Category Autocomplete</label>
                <field id="max_size" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Max Size</label>
                    <validate>integer</validate>
                    <comment><![CDATA[Maximum number of categories to display in autocomplete results.]]></comment>
                </field>
            </group>
        </section>

        <section id="smile_elasticsuite_catalogsearch_settings" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Catalog Search</label>
            <tab>smile_elasticsuite</tab>
            <resource>Magento_Backend::smile_elasticsuite_catalogsearch</resource>

            <group id="catalogsearch" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Catalog Search Configuration</label>
                <field id="category_name_weight" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
                    <label>Category Name Weight</label>
                    <source_model>Magento\CatalogSearch\Model\Source\Weight</source_model>
                    <comment><![CDATA[The search weight of category names when used in fulltext search.]]></comment>
                </field>
                <field id="redirect_if_one_result" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Redirect to product page if only one result</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If there is only one product matching a given search query, the user will be redirect to this product page.]]></comment>
                </field>
                <field id="category_filter_use_url_rewrites" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Use URL Rewrites for Category Filter in category navigation</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[When set to yes, users are redirected (and all filters are reset) to the chosen category page when they use the category filter in layered navigation.]]></comment>
                </field>
                <field id="expanded_facets" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Expanded facets</label>
                    <validate>integer</validate>
                    <comment><![CDATA[Number of facets to display expanded by default.]]></comment>
                </field>
                <field id="adaptive_slider_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Enable adaptive slider</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If enabled, when necessary to support the presence of outlier values in the navigation context (for instance, a very high price amidst a majority of low prices), the price slider behavior changes so that the middle of the slider range corresponds to the median price instead of the price at the middle of the range.]]></comment>
                </field>
                <field id="index_child_product_sku" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Enable indexing child product SKU in dedicated subfield</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If enabled, child products SKUs of composite products will be indexed in a separate field and the "sku" field will only contain the parent product sku.]]></comment>
                </field>
                <field id="compute_child_product_discount" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Enable indexing discount on child products</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[Enable this if your catalog contains configurable products that are having childrens with different prices that could have separated discounts.]]></comment>
                </field>
                <field id="ignore_oos_product_positions" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Ignore manual positions of out of stock products</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If you show out of stock products in the frontend (through the "Catalog / Inventory / Stock Options / Display Out of Stock Products" stores configuration setting), switch this setting to Yes to make sure that a manually positionned product (in categories or in search queries) is no longer shown in the configured manual positions when it becomes out of stock.]]></comment>
                </field>
                <field id="collector_fields_scoring_algorithm" translate="label comment" type="select" sortOrder="80" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
                    <label>Text scoring algorithm for collector fields</label>
                    <source_model>Smile\ElasticsuiteCatalog\Model\Attribute\Source\TextScoringAlgorithm</source_model>
                    <comment><![CDATA[When performing a search, Elasticsuite will look both into fields related to searchable attributes with a search weight greater than 1 and into special collector fields ("search", "spelling", etc.) where searchable attributes data can be copied to.<br />The text scoring algorithm (or "similarity") determines how the relevance score is computed for a field during search. While you can change it for every searchable attribute (in its advanced properties), you might want to also change it for those collector fields.<br />Selecting "Default" will let your server apply the default scoring algorithm which takes into account every occurence of a search term in a field. Eg: a product with "dress" 3 times in its "search" field should be scored higher than a product with "dress" only 1 time in its own "search" field.<br/> You can opt for a "Boolean" scoring model that produces at most a score of 1 for the whole field whatever the number of matches. Eg: the product with "dress" 3 times in its "spelling" field would be scored the same as the product with "dress" only 1 time in its own "spelling" field.]]></comment>
                </field>
            </group>
            <group id="explicit_url_rewrite_support" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Explicit URL rewrites support</label>
                <field id="info" translate="label comment" type="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>How this works</label>
                    <comment><![CDATA[By default, for performance reasons, Elasticsuite <strong>does not look into the URL Rewrites table at indexing time</strong> and rely instead on <strong>redirect URLs being automatically created by Magento when you change the URL key of a category</strong>. In the autocomplete, Elasticsuite thus reconstructs the URL of a category based on its url_key / url_path and the configured URL suffix which should always lead to a valid URL.<br />But if you often disable the automatic creation of those redirect URLs or if a user (or a third party module) frequently modifies the auto-generated URLs of categories, it can lead to categories being displayed in the autocomplete with an obsolete URL leading to a 404 page.<br />The setting below allows you to force Elasticsuite to look into the URL Rewrites table at indexing time to avoid that problem at the cost of a slight increase in indexing time.]]></comment>
                    <frontend_model>Smile\ElasticsuiteCore\Block\Adminhtml\System\Config\Comment</frontend_model>
                </field>
                <field id="categories" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Enabled for categories</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If set to "Yes", at indexing time, Elasticsuite will explicitely look into the URL Rewrites table (containing all the data visible from "Marketing > SEO & Search > URL Rewrites") to index the current URL of a category in order to display it in autocomplete results. If set to "No", Elasticsuite will use its legacy behavior of reconstructing the category URL from its indexed url_key / url_path and the configured URL suffix.]]></comment>
                </field>
            </group>
        </section>

        <section id="catalog">
            <group id="frontend">
                <field id="default_sort_direction_by" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Product Listing Sort Direction by</label>
                    <source_model>Smile\ElasticsuiteCatalog\Model\Config\Source\SortDirectionConfig</source_model>
                    <comment><![CDATA[Set the default sort direction for product listing.]]></comment>
                </field>
            </group>
        </section>
    </system>
</config>
