diff --git a/src/module-elasticsuite-catalog/Model/Autocomplete/Category/DataProvider.php b/src/module-elasticsuite-catalog/Model/Autocomplete/Category/DataProvider.php index 9d6bb4580..b8689df36 100644 --- a/src/module-elasticsuite-catalog/Model/Autocomplete/Category/DataProvider.php +++ b/src/module-elasticsuite-catalog/Model/Autocomplete/Category/DataProvider.php @@ -18,7 +18,7 @@ use Magento\Search\Model\QueryFactory; use Smile\ElasticsuiteCatalog\Helper\Autocomplete as ConfigurationHelper; use Smile\ElasticsuiteCatalog\Model\ResourceModel\Category\Fulltext\CollectionFactory as CategoryCollectionFactory; -use Smile\ElasticsuiteCore\Model\Autocomplete\Terms\DataProvider as TermDataProvider; +use Smile\ElasticsuiteCore\Model\Autocomplete\SuggestedTermsProvider; /** * Catalog category autocomplete data provider. @@ -49,7 +49,7 @@ class DataProvider implements DataProviderInterface protected $queryFactory; /** - * @var TermDataProvider + * @var SuggestedTermsProvider */ protected $termDataProvider; @@ -73,7 +73,7 @@ class DataProvider implements DataProviderInterface * * @param ItemFactory $itemFactory Suggest item factory. * @param QueryFactory $queryFactory Search query factory. - * @param TermDataProvider $termDataProvider Search terms suggester. + * @param SuggestedTermsProvider $termDataProvider Search terms suggester. * @param CategoryCollectionFactory $categoryCollectionFactory Category collection factory. * @param ConfigurationHelper $configurationHelper Autocomplete configuration helper. * @param string $type Autocomplete provider type. @@ -81,7 +81,7 @@ class DataProvider implements DataProviderInterface public function __construct( ItemFactory $itemFactory, QueryFactory $queryFactory, - TermDataProvider $termDataProvider, + SuggestedTermsProvider $termDataProvider, CategoryCollectionFactory $categoryCollectionFactory, ConfigurationHelper $configurationHelper, $type = self::AUTOCOMPLETE_TYPE @@ -143,23 +143,6 @@ private function isCategoryAvailable(Category $category): bool ; } - /** - * List of search terms suggested by the search terms data provider. - * - * @return array - */ - private function getSuggestedTerms() - { - $terms = array_map( - function (\Magento\Search\Model\Autocomplete\Item $termItem) { - return $termItem->getTitle(); - }, - $this->termDataProvider->getItems() - ); - - return $terms; - } - /** * Suggested categories collection. * Returns null if no suggested search terms. @@ -171,7 +154,7 @@ private function getCategoryCollection() { $categoryCollection = null; - $suggestedTerms = $this->getSuggestedTerms(); + $suggestedTerms = $this->termDataProvider->getSuggestedTerms(); $terms = [$this->queryFactory->get()->getQueryText()]; if (!empty($suggestedTerms)) { diff --git a/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Collection/Filter.php b/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Collection/Filter.php index b2ad5e9c1..02c18d840 100644 --- a/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Collection/Filter.php +++ b/src/module-elasticsuite-catalog/Model/Autocomplete/Product/Collection/Filter.php @@ -13,10 +13,8 @@ */ namespace Smile\ElasticsuiteCatalog\Model\Autocomplete\Product\Collection; -use Magento\Search\Model\QueryFactory; -use Smile\ElasticsuiteCore\Model\Autocomplete\Terms\DataProvider as TermDataProvider; -use Magento\Search\Model\Autocomplete\Item as TermItem; use Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection as ProductCollection; +use Smile\ElasticsuiteCore\Model\Autocomplete\SuggestedTermsProvider; /** * Catalog autocomplete product collection filter. @@ -27,13 +25,6 @@ */ class Filter implements PreProcessorInterface { - /** - * Query factory - * - * @var QueryFactory - */ - private $queryFactory; - /** * @var TermDataProvider */ @@ -42,12 +33,10 @@ class Filter implements PreProcessorInterface /** * Constructor. * - * @param QueryFactory $queryFactory Search term query factory. - * @param TermDataProvider $termDataProvider Popular search terms provider. + * @param SuggestedTermsProvider $termDataProvider Suggested search terms provider. */ - public function __construct(QueryFactory $queryFactory, TermDataProvider $termDataProvider) + public function __construct(SuggestedTermsProvider $termDataProvider) { - $this->queryFactory = $queryFactory; $this->termDataProvider = $termDataProvider; } @@ -61,31 +50,8 @@ public function __construct(QueryFactory $queryFactory, TermDataProvider $termDa */ public function prepareCollection(ProductCollection $collection) { - $terms = $this->getQueryText(); - - $collection->setSearchQuery($terms); + $collection->setSearchQuery($this->termDataProvider->getSuggestedTerms()); return $collection; } - - /** - * List of search terms suggested by the search terms data provider. - * - * @return array - */ - private function getQueryText() - { - $terms = array_map( - function (TermItem $termItem) { - return $termItem->getTitle(); - }, - $this->termDataProvider->getItems() - ); - - if (empty($terms)) { - $terms = [$this->queryFactory->get()->getQueryText()]; - } - - return $terms; - } } diff --git a/src/module-elasticsuite-core/Helper/Autocomplete.php b/src/module-elasticsuite-core/Helper/Autocomplete.php index 34f3f0123..2078c0a82 100644 --- a/src/module-elasticsuite-core/Helper/Autocomplete.php +++ b/src/module-elasticsuite-core/Helper/Autocomplete.php @@ -51,6 +51,68 @@ public function isEnabled($type) return $this->getMaxSize($type) > 0; } + /** + * Check if Autocomplete "extension" system is enabled. + * + * @return bool + */ + public function isExtensionEnabled() + { + return (bool) $this->scopeConfig->isSetFlag( + self::AUTOCOMPLETE_SETTINGS_CONFIG_XML_PREFIX . "/advanced/extension_enabled", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Check if Autocomplete "extension" system is limited. + * + * @return bool + */ + public function isExtensionLimited() + { + return (bool) ($this->scopeConfig->isSetFlag( + self::AUTOCOMPLETE_SETTINGS_CONFIG_XML_PREFIX . "/advanced/extension_limited", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )) && ($this->getExtensionSize() > 0); + } + + /** + * Get the maximum number of popular search terms to use when the "extension" is limited. + * + * @return int + */ + public function getExtensionSize() + { + return (int) $this->getConfigValue("advanced/extension_size"); + } + + /** + * Check if Autocomplete "extension" system is stopped when having matches. + * + * @return bool + */ + public function isExtensionStoppedOnMatch() + { + return (bool) $this->scopeConfig->isSetFlag( + self::AUTOCOMPLETE_SETTINGS_CONFIG_XML_PREFIX . "/advanced/stop_extension_on_match", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Check if Autocomplete is supposed to always use the user raw query or not. + * + * @return bool + */ + public function isPreservingBaseQuery() + { + return (bool) $this->scopeConfig->isSetFlag( + self::AUTOCOMPLETE_SETTINGS_CONFIG_XML_PREFIX . "/advanced/preserve_base_query", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** * Retrieve a configuration value by its key * diff --git a/src/module-elasticsuite-core/Model/Autocomplete/SuggestedTermsProvider.php b/src/module-elasticsuite-core/Model/Autocomplete/SuggestedTermsProvider.php new file mode 100644 index 000000000..4f7fc703d --- /dev/null +++ b/src/module-elasticsuite-core/Model/Autocomplete/SuggestedTermsProvider.php @@ -0,0 +1,132 @@ + + * @copyright 2024 Smile + * @license Open Software License ("OSL") v. 3.0 + */ + +namespace Smile\ElasticsuiteCore\Model\Autocomplete; + +use Magento\Search\Model\Autocomplete\Item as TermItem; +use Smile\ElasticsuiteCore\Helper\Autocomplete; +use Smile\ElasticsuiteCore\Model\Autocomplete\Terms\DataProvider as TermDataProvider; +use Smile\ElasticsuiteCore\Model\Search\QueryStringProviderFactory; + +/** + * Suggested Terms Provider. + * Based on the Term provider but will manipulate it according to configuration. + * + * @category Smile + * @package Smile\ElasticsuiteCore + * @author Romain Ruaud + */ +class SuggestedTermsProvider +{ + /** + * @var \Smile\ElasticsuiteCore\Model\Autocomplete\Terms\DataProvider + */ + private $termDataProvider; + + /** + * @var \Smile\ElasticsuiteCatalog\Helper\Autocomplete + */ + private $helper; + + /** + * @var \Smile\ElasticsuiteCore\Model\Search\QueryStringProviderFactory + */ + private $queryStringProviderFactory; + + /** + * @var null|string + */ + private $queryString = null; + + /** + * @var null + */ + private $terms = null; + + /** + * @param Autocomplete $helper Autocomplete helper + * @param TermDataProvider $termDataProvider Term data provider + * @param QueryStringProviderFactory $queryStringProviderFactory Search Query Factory + */ + public function __construct( + Autocomplete $helper, + TermDataProvider $termDataProvider, + QueryStringProviderFactory $queryStringProviderFactory + ) { + $this->helper = $helper; + $this->termDataProvider = $termDataProvider; + $this->queryStringProviderFactory = $queryStringProviderFactory; + } + + /** + * List of search terms suggested by the search terms data provider, and reworked according to configuration. + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * + * @return array|string[] + */ + public function getSuggestedTerms() + { + if (null === $this->terms) { + $terms = []; + + if ($this->helper->isExtensionEnabled()) { + $terms = array_map( + function (TermItem $termItem) { + return trim($termItem->getTitle()); + }, + $this->termDataProvider->getItems() + ); + + $hasAlreadyStoppedExtending = false; + if ($this->helper->isExtensionStoppedOnMatch()) { + if (array_search(trim($this->getQueryString()), $terms) !== false) { + $terms = [$this->getQueryString()]; + $hasAlreadyStoppedExtending = true; + } + } + + if ($this->helper->isExtensionLimited() && !$hasAlreadyStoppedExtending) { + $terms = array_slice($terms, 0, (int) $this->helper->getExtensionSize()); + } + + if ($this->helper->isPreservingBaseQuery() && !$hasAlreadyStoppedExtending) { + array_unshift($terms, $this->getQueryString()); + } + } + + if (empty($terms)) { + $terms = [$this->getQueryString()]; + } + + $this->terms = array_values(array_unique($terms)); + } + + return $this->terms; + } + + /** + * Retrieve current query string + * + * @return string + */ + private function getQueryString() + { + if ($this->queryString === null) { + $this->queryString = $this->queryStringProviderFactory->create()->get(); + } + + return $this->queryString; + } +} diff --git a/src/module-elasticsuite-core/Model/Search/QueryStringProvider.php b/src/module-elasticsuite-core/Model/Search/QueryStringProvider.php new file mode 100644 index 000000000..e3ac30a29 --- /dev/null +++ b/src/module-elasticsuite-core/Model/Search/QueryStringProvider.php @@ -0,0 +1,70 @@ + + * @copyright 2024 Smile + * @license Open Software License ("OSL") v. 3.0 + */ + +namespace Smile\ElasticsuiteCore\Model\Search; + +use Magento\Framework\Stdlib\StringUtils; +use Magento\Framework\App\RequestInterface; +use Magento\Search\Model\QueryFactory; + +/** + * Query String provider : will fetch current search query from current request. + * + * @category Smile + * @package Smile\ElasticsuiteCore + * @author Romain Ruaud + */ +class QueryStringProvider +{ + /** + * @var RequestInterface + */ + private $request; + + /** @var StringUtils */ + private $string; + + /** + * @var null|string + */ + private $currentQuery = null; + + /** + * QueryStringProvider constructor. + * + * @param RequestInterface $request HTTP Request + * @param StringUtils $string String utils + */ + public function __construct(RequestInterface $request, StringUtils $string) + { + $this->request = $request; + $this->string = $string; + } + + /** + * Get current query string. + * + * @return string + */ + public function get() + { + if ($this->currentQuery === null) { + $queryText = $this->request->getParam(QueryFactory::QUERY_VAR_NAME); + + $this->currentQuery = ($queryText === null || is_array($queryText)) ? '' : $this->string->cleanString(trim($queryText)); + } + + return $this->currentQuery; + } +} diff --git a/src/module-elasticsuite-core/Test/Unit/Model/SuggestedTermsProviderTest.php b/src/module-elasticsuite-core/Test/Unit/Model/SuggestedTermsProviderTest.php new file mode 100644 index 000000000..3e1b19c64 --- /dev/null +++ b/src/module-elasticsuite-core/Test/Unit/Model/SuggestedTermsProviderTest.php @@ -0,0 +1,347 @@ + + * @copyright 2024 Smile + * @license Open Software License ("OSL") v. 3.0 + */ +namespace Smile\ElasticsuiteCore\Test\Unit\Model; + +use PHPUnit\Framework\TestCase; +use Smile\ElasticsuiteCore\Model\Autocomplete\SuggestedTermsProvider; +use Smile\ElasticsuiteCore\Helper\Autocomplete; +use Smile\ElasticsuiteCore\Model\Autocomplete\Terms\DataProvider as TermDataProvider; +use Smile\ElasticsuiteCore\Model\Search\QueryStringProvider; +use Magento\Search\Model\Autocomplete\Item as TermItem; + +/** + * Search API unit testing. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * + * @category Smile + * @package Smile\ElasticsuiteCore + * @author Romain Ruaud + */ +class SuggestedTermsProviderTest extends TestCase +{ + /** + * @var (\object&\PHPUnit\Framework\MockObject\MockObject) + */ + private $helperMock; + + /** + * @var (\object&\PHPUnit\Framework\MockObject\MockObject) + */ + private $termDataProviderMock; + + /** + * @var (\object&\PHPUnit\Framework\MockObject\MockObject) + */ + private $queryStringProviderFactoryMock; + + /** + * @var (\object&\PHPUnit\Framework\MockObject\MockObject) + */ + private $suggestedTermsProvider; + + /** + * Test setup + * + * @return void + */ + protected function setUp(): void + { + $this->helperMock = $this->createMock(Autocomplete::class); + $this->termDataProviderMock = $this->createMock(TermDataProvider::class); + $this->queryStringProviderFactoryMock = $this->getMockBuilder(QueryStringProvider::class. 'Factory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->suggestedTermsProvider = new SuggestedTermsProvider( + $this->helperMock, + $this->termDataProviderMock, + $this->queryStringProviderFactoryMock + ); + } + + /** + * Test case when extension is enabled and no limit on the number of suggested terms. + * It should return all available terms. + */ + public function testGetSuggestedTermsWithExtensionEnabledAndNoLimit() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(false); + + // Create mock TermItems with terms starting with 'top'. + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + $expectedTerms = ['top', 'top blouse', 'top tank']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is enabled, and results are limited to one term. + * It should return only the first term. + */ + public function testGetSuggestedTermsWithLimitedResultsOneTerm() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(true); + $this->helperMock->method('getExtensionSize')->willReturn(1); + + // Create mock TermItems with terms starting with 'top'. + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + // Expect the terms to be limited to only one item. + $expectedTerms = ['top']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is enabled, and results are limited to two terms. + * It should return the first two terms. + */ + public function testGetSuggestedTermsWithLimitedResultsTwoTerms() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(true); + $this->helperMock->method('getExtensionSize')->willReturn(2); + + // Create mock TermItems with terms starting with 'top'. + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + $expectedTerms = ['top', 'top blouse']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is enabled, and results are limited to three terms. + * It should return the first three terms. + */ + public function testGetSuggestedTermsWithLimitedResultsThreeTerms() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(true); + $this->helperMock->method('getExtensionSize')->willReturn(3); + + // Create mock TermItems with terms starting with 'top'. + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + $expectedTerms = ['top', 'top blouse', 'top tank']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is enabled, and limit is greater than the number of available terms. + * It should return all available terms. + */ + public function testGetSuggestedTermsWithLimitedResultsLessThanSize() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(true); + // Limit set to 5, but only 3 items are available. + $this->helperMock->method('getExtensionSize')->willReturn(5); + + // Create mock TermItems with terms starting with 'top'. + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + $expectedTerms = ['top', 'top blouse', 'top tank']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is disabled. + * It should return the query string as the term. + */ + public function testGetSuggestedTermsWhenExtensionDisabled() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(false); + + $queryStringProviderMock = $this->createMock(\Smile\ElasticsuiteCore\Model\Search\QueryStringProvider::class); + $queryStringProviderMock->method('get')->willReturn('top'); + $this->queryStringProviderFactoryMock->method('create')->willReturn($queryStringProviderMock); + + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $termItem3 = $this->createMock(TermItem::class); + $termItem3->method('getTitle')->willReturn('top tank'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2, $termItem3]); + + // Expect the terms to be the query string since the extension is disabled. + $expectedTerms = ['top']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Test case when extension is enabled and stopped on match. + * It should return only the term that matches the query string. + */ + public function testGetSuggestedTermsWithExtensionStoppedOnMatch() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(true); + $this->helperMock->method('isExtensionLimited')->willReturn(false); + + $queryStringProviderMock = $this->createMock(\Smile\ElasticsuiteCore\Model\Search\QueryStringProvider::class); + $queryStringProviderMock->method('get')->willReturn('top'); + $this->queryStringProviderFactoryMock->method('create')->willReturn($queryStringProviderMock); + + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2]); + + // Expect the terms to be only 'top' because of the stop on match logic. + $expectedTerms = ['top']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Tests the scenario where the base query is preserved and added to the suggestions. + * + * @return void + */ + public function testGetSuggestedTermsWithBaseQueryPreserved() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(false); + $this->helperMock->method('isPreservingBaseQuery')->willReturn(true); + + $queryStringProviderMock = $this->createMock(QueryStringProvider::class); + $queryStringProviderMock->method('get')->willReturn('to'); + $this->queryStringProviderFactoryMock->method('create')->willReturn($queryStringProviderMock); + + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2]); + + $expectedTerms = ['to', 'top', 'top blouse']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } + + /** + * Tests the case where the base query matches one of the suggested terms, ensuring duplicates are removed. + * + * @return void + */ + public function testGetSuggestedTermsWithBaseQueryPreservedAndDuplicate() + { + $this->helperMock->method('isExtensionEnabled')->willReturn(true); + $this->helperMock->method('isExtensionStoppedOnMatch')->willReturn(false); + $this->helperMock->method('isExtensionLimited')->willReturn(false); + $this->helperMock->method('isPreservingBaseQuery')->willReturn(true); + + $queryStringProviderMock = $this->createMock(QueryStringProvider::class); + $queryStringProviderMock->method('get')->willReturn('top'); + $this->queryStringProviderFactoryMock->method('create')->willReturn($queryStringProviderMock); + + $termItem1 = $this->createMock(TermItem::class); + $termItem1->method('getTitle')->willReturn('top'); + + $termItem2 = $this->createMock(TermItem::class); + $termItem2->method('getTitle')->willReturn('top blouse'); + + $this->termDataProviderMock->method('getItems')->willReturn([$termItem1, $termItem2]); + + $expectedTerms = ['top', 'top blouse']; + + $terms = $this->suggestedTermsProvider->getSuggestedTerms(); + + $this->assertEquals($expectedTerms, $terms); + } +} diff --git a/src/module-elasticsuite-core/etc/adminhtml/system.xml b/src/module-elasticsuite-core/etc/adminhtml/system.xml index 3211101a0..43829e41c 100644 --- a/src/module-elasticsuite-core/etc/adminhtml/system.xml +++ b/src/module-elasticsuite-core/etc/adminhtml/system.xml @@ -180,6 +180,53 @@ + + + + + + For instance, if a user types "comp" in the search box and the suggested popular search terms are "computer", "peach computer", "computer for kids", then categories and products matching either one of those three search terms will be shown and the original "comp" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only "comp", which might not provide any results unless some attributes have built-in autocompletion capability (by using the "standard_edge_ngram" as their search analyzer).
The settings below provide you with the ability to have more control over that "extension" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc.]]>
+ Smile\ElasticsuiteCore\Block\Adminhtml\System\Config\Comment +
+ + + Magento\Config\Model\Config\Source\Yesno + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + + required integer validate-greater-than-zero + + 1 + 1 + + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + +
diff --git a/src/module-elasticsuite-core/etc/config.xml b/src/module-elasticsuite-core/etc/config.xml index 4ea302422..83ddf5528 100644 --- a/src/module-elasticsuite-core/etc/config.xml +++ b/src/module-elasticsuite-core/etc/config.xml @@ -53,6 +53,13 @@ 3 + + 1 + 0 + 0 + 5 + 0 + diff --git a/src/module-elasticsuite-core/i18n/de_DE.csv b/src/module-elasticsuite-core/i18n/de_DE.csv index c8a49fe6e..281272ca2 100644 --- a/src/module-elasticsuite-core/i18n/de_DE.csv +++ b/src/module-elasticsuite-core/i18n/de_DE.csv @@ -130,3 +130,16 @@ "You have %1 ghost indices. Ghost indices have a footprint on your Elasticsearch cluster health. You should consider removing them.","Sie haben %1 Geister-Indizes. Geister-Indizes haben einen Fußabdruck auf Ihrer Elasticsearch Cluster-Gesundheit. Sie sollten in Erwägung ziehen, sie zu entfernen." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Klicken Sie hier, um zu den Elasticsuite Indizes Seite zu gelangen, um entsprechende Aktionen durchzuführen." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Klicken Sie hier, um zu den Elasticsuite Indizes Seite zu gelangen, um entsprechende Aktionen durchzuführen." +"Advanced Settings","Erweiterte Einstellungen" +"Using popular search terms for autocomplete search of products and categories","Verwendung beliebter Suchbegriffe zur automatischen Vervollständigung der Suche nach Produkten und Kategorien" +"Historically, both for leveraging user behavioral patterns and performance purposes, Elasticsuite relies on the Popular Search Terms Autocomplete results to complete and extend the search terms submitted by the user before searching for matching products or categories.
For instance, if a user types ""comp"" in the search box and the suggested popular search terms are ""computer"", ""peach computer"", ""computer for kids"", then categories and products matching either one of those three search terms will be shown and the original ""comp"" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only ""comp"", which might not provide any results unless some attributes have built-in autocompletion capability (by using the ""standard_edge_ngram"" as their search analyzer).
The settings below provide you with the ability to have more control over that ""extension"" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc.","Traditionell verlässt sich Elasticsuite sowohl für die Nutzung von Benutzerverhaltensmustern als auch für Leistungszwecke auf die Ergebnisse der automatischen Vervollständigung beliebter Suchbegriffe, um die vom Benutzer übermittelten Suchbegriffe zu vervollständigen und zu erweitern, bevor nach passenden Produkten oder Kategorien gesucht wird.
Zum Beispiel, wenn ein Benutzer Geben Sie ""comp"" in das Suchfeld ein und die vorgeschlagenen beliebten Suchbegriffe sind ""Computer"", ""Pfirsich Computer"" und ""Computer für Kinder"". Anschließend werden Kategorien und Produkte angezeigt, die einem dieser drei Suchbegriffe entsprechen wird angezeigt und der ursprüngliche ""Comp"" Suchbegriff wird verworfen.
Wenn andererseits kein beliebter Suchbegriff gefunden wird, versucht Elasticsuite, Produkte und Kategorien zu finden, die nur mit ""comp"" übereinstimmen. Dies liefert möglicherweise keine Ergebnisse, es sei denn, einige Attribute verfügen über integrierte in der Fähigkeit zur automatischen Vervollständigung (durch Verwendung von ""standard_edge_ngram"" als Suchanalysator).
Die folgenden Einstellungen bieten Ihnen die Möglichkeit, mehr Kontrolle über diesen ""Erweiterungs""-Mechanismus zu haben: ob Sie ihn vollständig deaktivieren oder einschränken möchten seine Ausdehnung, Erzwingen, dass immer der ursprüngliche Suchbegriff abgefragt wird usw." +"Use suggested search terms to fetch results","Verwenden Sie vorgeschlagene Suchbegriffe, um Ergebnisse abzurufen" +"Default: Yes (legacy behavior). When set to ""Yes"", products and categories autocomplete will use the search terms suggested in the popular term autocomplete. When set to ""No"", products and categories autocomplete results will be based solely on the original user raw search term, which might be a partial word being typed (eg ""comp"" for ""computer"").","Standard: Ja (Legacy-Verhalten). Bei der Einstellung ""Ja"" verwendet die Autovervollständigung für Produkte und Kategorien die Suchbegriffe, die in der beliebten Autovervollständigung vorgeschlagen werden. Bei der Einstellung ""Nein"" basieren die Ergebnisse der automatischen Vervollständigung von Produkten und Kategorien ausschließlich auf dem ursprünglichen Rohsuchbegriff des Benutzers, bei dem es sich möglicherweise um einen Teil des eingegebenen Worts handelt (z. B. ""comp"" für ""Computer"")." +"Always use the user raw input for suggestions","Immer die Rohdaten des Benutzers für Vorschläge verwenden" +"Default: No (legacy behavior). When set to ""No"", the user raw search term, which might be a partial word being typed, will only be used to fetch suggestions if no matching popular terms were found. When set to ""Yes"", it will always be used, whether matching popular terms were found or not. Eg if set to ""Yes"" : when the user is typing ""comp"" and the popular search term ""computer"" is suggested, then products or categories matching either ""comp"" or ""computer"" will be shown.","Standard: Nein (Legacy-Verhalten). Bei der Einstellung ""Nein"" wird der Rohsuchbegriff des Benutzers, bei dem es sich möglicherweise um einen Teil des eingegebenen Wortes handelt, nur zum Abrufen von Vorschlägen verwendet, wenn keine passenden beliebten Begriffe gefunden wurden. Bei der Einstellung ""Ja"" wird immer verwendet, unabhängig davon, ob passende beliebte Begriffe gefunden wurden oder nicht. Wenn beispielsweise ""Ja"" eingestellt ist: Wenn der Benutzer ""comp"" eingibt und der beliebte Suchbegriff ""Computer"" vorgeschlagen wird, werden Produkte oder Kategorien angezeigt, die entweder mit ""comp"" oder ""computer"" übereinstimmen." +"Limit the amount of suggested search terms used","Begrenzen Sie die Anzahl der vorgeschlagenen Suchbegriffe" +"Default: No (legacy behavior). When set to ""No"", all the suggested popular search terms will be used for the products and categories autocomplete. When set to ""Yes"", you will be able to define the maximum number of suggested search terms to use below.","Standard: Nein (Legacy-Verhalten). Bei der Einstellung ""Nein"" werden alle vorgeschlagenen beliebten Suchbegriffe für die automatische Vervollständigung von Produkten und Kategorien verwendet. Bei Einstellung auf ""Ja"" können Sie unten die maximale Anzahl der vorgeschlagenen Suchbegriffe definieren, die verwendet werden sollen." +"Maximum number of popular search terms to use","Maximale Anzahl beliebter Suchbegriffe zu verwenden" +"The maximum number of suggested search terms that will be used for fetching results in the products and categories autocomplete boxes. Having a value greater than the ""Max Size"" defined in the ""Popular Term Autocomplete"" section above has no effect.","Die maximale Anzahl vorgeschlagener Suchbegriffe, die zum Abrufen von Ergebnissen in den Autovervollständigungsfeldern für Produkte und Kategorien verwendet werden. Ein Wert, der größer als die im Abschnitt ""Autovervollständigung geläufiger Bezeichnungen"" oben definierte ""Maximale Größe"" ist, hat keine Auswirkung." +"No extension for actual popular search terms","Keine Erweiterung für tatsächlich beliebte Suchbegriffe" +"Default: No. When set to ""Yes"", the extension mechanism will be discarded when the search term entered by the user is amongst the popular terms suggestions. Eg : When the user has finished typing ""computer"", if the list of suggested search terms is (""computer"", ""peach computer"", ""computer for kids""), only ""computer"" will be taken into account for the products and categories autocomplete.","Standard: Nein. Bei der Einstellung ""Ja"" wird der Erweiterungsmechanismus verworfen, wenn der vom Benutzer eingegebene Suchbegriff zu den Vorschlägen für beliebte Begriffe gehört. Beispiel: Wenn der Benutzer mit der Eingabe von ""Computer"" fertig ist und die Liste der vorgeschlagenen Suchbegriffe ""Computer"", ""Pfirsich Computer"", ""Computer für Kinder"" lautet, wird nur ""Computer"" für die Produkte und berücksichtigt Kategorien automatisch vervollständigen." diff --git a/src/module-elasticsuite-core/i18n/en_US.csv b/src/module-elasticsuite-core/i18n/en_US.csv index cb1c0cc10..23a4e9706 100644 --- a/src/module-elasticsuite-core/i18n/en_US.csv +++ b/src/module-elasticsuite-core/i18n/en_US.csv @@ -140,3 +140,16 @@ Autocomplete,Autocomplete "You have %1 ghost indices. Ghost indices have a footprint on your Elasticsearch cluster health. You should consider removing them.","You have %1 ghost indices. Ghost indices have a footprint on your Elasticsearch cluster health. You should consider removing them." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Click here to go to the Elasticsuite Indices page to take appropriate actions." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Click here to go to the Elasticsuite Indices page to take appropriate actions." +"Advanced Settings","Advanced Settings" +"Using popular search terms for autocomplete search of products and categories","Using popular search terms for autocomplete search of products and categories" +"Historically, both for leveraging user behavioral patterns and performance purposes, Elasticsuite relies on the Popular Search Terms Autocomplete results to complete and extend the search terms submitted by the user before searching for matching products or categories.
For instance, if a user types ""comp"" in the search box and the suggested popular search terms are ""computer"", ""peach computer"", ""computer for kids"", then categories and products matching either one of those three search terms will be shown and the original ""comp"" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only ""comp"", which might not provide any results unless some attributes have built-in autocompletion capability (by using the ""standard_edge_ngram"" as their search analyzer).
The settings below provide you with the ability to have more control over that ""extension"" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc.","Historically, both for leveraging user behavioral patterns and performance purposes, Elasticsuite relies on the Popular Search Terms Autocomplete results to complete and extend the search terms submitted by the user before searching for matching products or categories.
For instance, if a user types ""comp"" in the search box and the suggested popular search terms are ""computer"", ""peach computer"", ""computer for kids"", then categories and products matching either one of those three search terms will be shown and the original ""comp"" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only ""comp"", which might not provide any results unless some attributes have built-in autocompletion capability (by using the ""standard_edge_ngram"" as their search analyzer).
The settings below provide you with the ability to have more control over that ""extension"" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc." +"Use suggested search terms to fetch results","Use suggested search terms to fetch results" +"Default: Yes (legacy behavior). When set to ""Yes"", products and categories autocomplete will use the search terms suggested in the popular term autocomplete. When set to ""No"", products and categories autocomplete results will be based solely on the original user raw search term, which might be a partial word being typed (eg ""comp"" for ""computer"").","Default: Yes (legacy behavior). When set to ""Yes"", products and categories autocomplete will use the search terms suggested in the popular term autocomplete. When set to ""No"", products and categories autocomplete results will be based solely on the original user raw search term, which might be a partial word being typed (eg ""comp"" for ""computer"")." +"Always use the user raw input for suggestions","Always use the user raw input for suggestions" +"Default: No (legacy behavior). When set to ""No"", the user raw search term, which might be a partial word being typed, will only be used to fetch suggestions if no matching popular terms were found. When set to ""Yes"", it will always be used, whether matching popular terms were found or not. Eg if set to ""Yes"" : when the user is typing ""comp"" and the popular search term ""computer"" is suggested, then products or categories matching either ""comp"" or ""computer"" will be shown.","Default: No (legacy behavior). When set to ""No"", the user raw search term, which might be a partial word being typed, will only be used to fetch suggestions if no matching popular terms were found. When set to ""Yes"", it will always be used, whether matching popular terms were found or not. Eg if set to ""Yes"" : when the user is typing ""comp"" and the popular search term ""computer"" is suggested, then products or categories matching either ""comp"" or ""computer"" will be shown." +"Limit the amount of suggested search terms used","Limit the amount of suggested search terms used" +"Default: No (legacy behavior). When set to ""No"", all the suggested popular search terms will be used for the products and categories autocomplete. When set to ""Yes"", you will be able to define the maximum number of suggested search terms to use below.","Default: No (legacy behavior). When set to ""No"", all the suggested popular search terms will be used for the products and categories autocomplete. When set to ""Yes"", you will be able to define the maximum number of suggested search terms to use below." +"Maximum number of popular search terms to use","Maximum number of popular search terms to use" +"The maximum number of suggested search terms that will be used for fetching results in the products and categories autocomplete boxes. Having a value greater than the ""Max Size"" defined in the ""Popular Term Autocomplete"" section above has no effect.","The maximum number of suggested search terms that will be used for fetching results in the products and categories autocomplete boxes. Having a value greater than the ""Max Size"" defined in the ""Popular Term Autocomplete"" section above has no effect." +"No extension for actual popular search terms","No extension for actual popular search terms" +"Default: No. When set to ""Yes"", the extension mechanism will be discarded when the search term entered by the user is amongst the popular terms suggestions. Eg : When the user has finished typing ""computer"", if the list of suggested search terms is (""computer"", ""peach computer"", ""computer for kids""), only ""computer"" will be taken into account for the products and categories autocomplete.","Default: No. When set to ""Yes"", the extension mechanism will be discarded when the search term entered by the user is amongst the popular terms suggestions. Eg : When the user has finished typing ""computer"", if the list of suggested search terms is (""computer"", ""peach computer"", ""computer for kids""), only ""computer"" will be taken into account for the products and categories autocomplete." diff --git a/src/module-elasticsuite-core/i18n/fr_FR.csv b/src/module-elasticsuite-core/i18n/fr_FR.csv index f2177dc7e..3e96973f7 100644 --- a/src/module-elasticsuite-core/i18n/fr_FR.csv +++ b/src/module-elasticsuite-core/i18n/fr_FR.csv @@ -140,3 +140,16 @@ General,Général "You have %1 ghost indices. Ghost indices have a footprint on your Elasticsearch cluster health. You should consider removing them.","Vous avez %1 index fantômes. Les indexs fantômes consomment inutilement des ressources de votre cluster Elasticsearch. Vous devriez envisager de les supprimer." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Cliquez ici pour accéder à la liste des indexs Elasticsuite et prendre les actions appropriées." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Cliquez ici pour accéder à la liste des indexs Elasticsuite et prendre les actions appropriées." +"Advanced Settings","Paramètres avancés" +"Using popular search terms for autocomplete search of products and categories","Utilisation des termes de recherche populaires pour la recheche par autocomplétion des produits et des catégories" +"Historically, both for leveraging user behavioral patterns and performance purposes, Elasticsuite relies on the Popular Search Terms Autocomplete results to complete and extend the search terms submitted by the user before searching for matching products or categories.
For instance, if a user types ""comp"" in the search box and the suggested popular search terms are ""computer"", ""peach computer"", ""computer for kids"", then categories and products matching either one of those three search terms will be shown and the original ""comp"" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only ""comp"", which might not provide any results unless some attributes have built-in autocompletion capability (by using the ""standard_edge_ngram"" as their search analyzer).
The settings below provide you with the ability to have more control over that ""extension"" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc.","Historiquement, à la fois pour bénéficier des comportements utilisateurs et pour des raisons de performance, Elasticsuite s'appuie sur le résultat de l'Autocomplétion des recherches populaires pour compléter et étendre le(s) terme(s) de recherche saisi(s) par l'utilisateur avant d'effectuer la recherche de produits ou catégories correspondants.
Par exemple, si l'utilisateur saisit ""ord"" dans le champ de recherche et que les termes de recherche populaires suggérés sont ""ordinateur"", ""ordinateur pêche"", ""ordinateur pour enfants"", alors les catégories et produits correspondant à un ou plusieurs de ces trois termes de recherche seront affichés tandis que le terme de recherche originel ""ord"" sera ignoré.
En revanche, si aucun terme de recherche populaire n'est trouvé, alors Elasticsuite essaiera de trouver des produits et des catégories correspondant uniquement à ""ord"", ce qui a des chances de ne produire aucun résultat à moins que certains attributs soient capables de fournir de l'autocomplétion par eux-même (en utilisant ""standard_edge_ngram"" comme analyseur de recherche).
Les paramètres ci-dessous vous permettent d'avoir plus de contrôle sur ce mécanisme ""d'extension"" : le désactiver entièrement ou non, le conserver en le limitant, forcer le terme de recherche d'origine à toujours être requêté, etc.", +"Use suggested search terms to fetch results","Utiliser les termes de recherche suggérés pour étendre la requête" +"Default: Yes (legacy behavior). When set to ""Yes"", products and categories autocomplete will use the search terms suggested in the popular term autocomplete. When set to ""No"", products and categories autocomplete results will be based solely on the original user raw search term, which might be a partial word being typed (eg ""comp"" for ""computer"").","Par défaut: Oui (comportement historique). Lorsque réglé à ""Oui"", l'autocomplétion des produits et des catégories utilisera les termes de recherche suggérés dans l'autocomplétion des termes de recherches populaires. Lorsque réglé à ""Non"", les résultats de l'autocomplétion des produits et des catégories seront uniquement basés sur le terme de recherche brut d'origine de l'utilisateur, qui peut être un mot incomplet en train d'être saisi (par exemple ""ord"" for ""ordinateur"")." +"Always use the user raw input for suggestions","Toujours utiliser la saisie brute de l'utilisateur pour les suggestions" +"Default: No (legacy behavior). When set to ""No"", the user raw search term, which might be a partial word being typed, will only be used to fetch suggestions if no matching popular terms were found. When set to ""Yes"", it will always be used, whether matching popular terms were found or not. Eg if set to ""Yes"" : when the user is typing ""comp"" and the popular search term ""computer"" is suggested, then products or categories matching either ""comp"" or ""computer"" will be shown.","Par défaut: Non (comportement historique). Lorsque réglé à ""Non"", le terme de recherche brut de l'utilisateur, qui peut être un mot en train d'être saisi, ne sera utilisé pour récupérer des résultats que si aucun terme de recherche populaire proche n'est trouvé. Lorsque réglé à ""Oui"", il sera toujours utilisé, que des termes de recherche proches aient été trouvés ou non. Par exemple si réglé à ""Oui"" : lorsque l'utilisateur saisit ""ord"" et que le terme de recherche populaire ""ordinateur"" est suggéré, alors des produits ou catégories matchant ""ord"" ou ""ordinateur"" seront affichés." +"Limit the amount of suggested search terms used","Limiter le nombre de termes de recherche suggérés utilisés" +"Default: No (legacy behavior). When set to ""No"", all the suggested popular search terms will be used for the products and categories autocomplete. When set to ""Yes"", you will be able to define the maximum number of suggested search terms to use below.","Par défault: Non (comportement historique). Lorsque réglé à ""Non"", tous les termes de recherche populaires suggérés seront utilisés pour l'autocomplétion des produits et des catégories. Lorsque réglé à ""Oui"", vous pourrez définir plus bas le nombre maximum de termes de recherche suggérés à utiliser." +"Maximum number of popular search terms to use","Nombre maximum de termes de recherche populaires à utiliser" +"The maximum number of suggested search terms that will be used for fetching results in the products and categories autocomplete boxes. Having a value greater than the ""Max Size"" defined in the ""Popular Term Autocomplete"" section above has no effect.","Le nombre maximum de termes de recherche suggérés qui seront utilisés pour récupérer des résultats dans les zones d'autocomplétion des produits et des catégories. Régler à une valeur supérieure à celle du champ ""Taille Maximum"" défini dans la section ""Autocomplétion des recherches populaires"" située plus haut n'a pas d'effet." +"No extension for actual popular search terms","Pas d'extension pour les termes de recherche populaires eux-mêmes" +"Default: No. When set to ""Yes"", the extension mechanism will be discarded when the search term entered by the user is amongst the popular terms suggestions. Eg : When the user has finished typing ""computer"", if the list of suggested search terms is (""computer"", ""peach computer"", ""computer for kids""), only ""computer"" will be taken into account for the products and categories autocomplete.","Par défault: Non. Lorsque réglé à ""Oui"", le mécanisme d'extension est désactivé lorsque le terme de recherche saisi par l'utilisateur est parmi les suggestions de recherches populaires. Par exemple, lorsque l'utilisateur a fini de saisir ""ordinateur"", si la liste des termes de recherche suggérés est (""ordinateur"", ""ordinateur pêche"", ""ordinateur pour enfants""), seul le terme ""ordinateur"" sera pris en compte pour l'autocomplétion des produits et des catégories." diff --git a/src/module-elasticsuite-core/i18n/nl_NL.csv b/src/module-elasticsuite-core/i18n/nl_NL.csv index 220a5af5b..de84914e5 100644 --- a/src/module-elasticsuite-core/i18n/nl_NL.csv +++ b/src/module-elasticsuite-core/i18n/nl_NL.csv @@ -130,3 +130,16 @@ "You have %1 ghost indices. Ghost indices have a footprint on your Elasticsearch cluster health. You should consider removing them.","Je hebt %1 spookindexen. Spook indices hebben een voetafdruk op je Elasticsearch cluster gezondheid. Je zou moeten overwegen om ze te verwijderen." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Klik hier om naar de Elasticsuite Indices pagina te gaan om de juiste acties te ondernemen." "Click here to go to the Elasticsuite Indices page to take appropriate actions.","Klik hier om naar de Elasticsuite Indices pagina te gaan om de juiste acties te ondernemen." +"Advanced Settings","Geavanceerde instellingen" +"Using popular search terms for autocomplete search of products and categories","Populaire zoektermen gebruiken voor het automatisch aanvullen van producten en categorieën" +"Historically, both for leveraging user behavioral patterns and performance purposes, Elasticsuite relies on the Popular Search Terms Autocomplete results to complete and extend the search terms submitted by the user before searching for matching products or categories.
For instance, if a user types ""comp"" in the search box and the suggested popular search terms are ""computer"", ""peach computer"", ""computer for kids"", then categories and products matching either one of those three search terms will be shown and the original ""comp"" search term is discarded.
On the other hand, if no popular search term is found, then Elasticsuite will try finding products and categories matching only ""comp"", which might not provide any results unless some attributes have built-in autocompletion capability (by using the ""standard_edge_ngram"" as their search analyzer).
The settings below provide you with the ability to have more control over that ""extension"" mechanism: whether to disable it entirely, limit its extend, forcing the original search term to always be requested, etc.","Historisch gezien vertrouwt Elasticsuite, zowel voor het benutten van gedragspatronen als voor prestatiedoeleinden, op de resultaten van automatisch aanvullen van populaire zoektermen om de door de gebruiker ingediende zoektermen aan te vullen en uit te breiden voordat naar overeenkomende producten of categorieën wordt gezocht.
Als een gebruiker bijvoorbeeld ""comp"" in het zoekvak typt en de voorgestelde populaire zoektermen ""computer"", ""perzik computer"", ""computer voor kinderen"" zijn, dan komen de categorieën en producten overeen met een van deze drie zoektermen wordt getoond en de oorspronkelijke zoekterm ""comp"" wordt weggegooid.
Aan de andere kant, als er geen populaire zoekterm wordt gevonden, zal Elasticsuite proberen producten en categorieën te vinden die alleen overeenkomen met ""comp"", wat mogelijk geen resultaten oplevert, tenzij bepaalde attributen hebben een ingebouwde mogelijkheid voor automatisch aanvullen (door de ""standard_edge_ngram"" als zoekanalysator te gebruiken).
De onderstaande instellingen bieden u de mogelijkheid om meer controle te hebben over dat ""extensie""-mechanisme: of u het volledig wilt uitschakelen, de omvang ervan wilt beperken, de oorspronkelijke zoekterm altijd moet opvragen, enz." +"Use suggested search terms to fetch results","Gebruik voorgestelde zoektermen om resultaten op te halen" +"Default: Yes (legacy behavior). When set to ""Yes"", products and categories autocomplete will use the search terms suggested in the popular term autocomplete. When set to ""No"", products and categories autocomplete results will be based solely on the original user raw search term, which might be a partial word being typed (eg ""comp"" for ""computer"").","Standaard: Ja (verouderd gedrag). Indien ingesteld op ""Ja"", zullen producten en categorieën automatisch aanvullen de zoektermen gebruiken die worden voorgesteld in de populaire term automatisch aanvullen. Indien ingesteld op ""Neen"", worden de resultaten voor automatisch aanvullen van producten en categorieën uitsluitend gebaseerd op de oorspronkelijke onbewerkte zoekterm van de gebruiker, wat een gedeeltelijk woord kan zijn dat wordt getypt (bijvoorbeeld ""comp"" voor ""computer"")." +"Always use the user raw input for suggestions","Altijd de ruwe invoer van de gebruiker gebruiken voor suggesties" +"Default: No (legacy behavior). When set to ""No"", the user raw search term, which might be a partial word being typed, will only be used to fetch suggestions if no matching popular terms were found. When set to ""Yes"", it will always be used, whether matching popular terms were found or not. Eg if set to ""Yes"" : when the user is typing ""comp"" and the popular search term ""computer"" is suggested, then products or categories matching either ""comp"" or ""computer"" will be shown.","Standaard: Neen (verouderd gedrag). Indien ingesteld op ""Neen"", wordt de onbewerkte zoekterm van de gebruiker, die mogelijk een gedeeltelijk woord is dat wordt getypt, alleen gebruikt om suggesties op te halen als er geen overeenkomende populaire termen zijn gevonden. Indien ingesteld op ""Ja"", wordt deze altijd gebruikt, ongeacht of er overeenkomende populaire termen zijn gevonden of niet. Als de gebruiker bijvoorbeeld ""comp"" typt en de populaire zoekterm ""computer"" wordt voorgesteld, dan worden producten of categorieën gevonden die overeenkomen met ""comp"" of ""computer"" zal worden getoond." +"Limit the amount of suggested search terms used","Beperk het aantal voorgestelde zoektermen dat u gebruikt" +"Default: No (legacy behavior). When set to ""No"", all the suggested popular search terms will be used for the products and categories autocomplete. When set to ""Yes"", you will be able to define the maximum number of suggested search terms to use below.","Standaard: Neen (verouderd gedrag). Indien ingesteld op ""Neen"", worden alle voorgestelde populaire zoektermen gebruikt voor het automatisch aanvullen van producten en categorieën. Indien ingesteld op ""Ja"", kunt u hieronder het maximale aantal voorgestelde zoektermen definiëren dat u kunt gebruiken." +"Maximum number of popular search terms to use","Maximaal aantal populaire zoektermen dat u kunt gebruiken" +"The maximum number of suggested search terms that will be used for fetching results in the products and categories autocomplete boxes. Having a value greater than the ""Max Size"" defined in the ""Popular Term Autocomplete"" section above has no effect.","Het maximale aantal voorgestelde zoektermen dat wordt gebruikt voor het ophalen van resultaten in de vakken voor automatisch aanvullen van producten en categorieën. Een waarde groter dan de ""Max Size"" gedefinieerd in het gedeelte ""Populaire term automatisch aanvullen"" hierboven heeft geen effect." +"No extension for actual popular search terms","Geen extensie voor daadwerkelijke populaire zoektermen" +"Default: No. When set to ""Yes"", the extension mechanism will be discarded when the search term entered by the user is amongst the popular terms suggestions. Eg : When the user has finished typing ""computer"", if the list of suggested search terms is (""computer"", ""peach computer"", ""computer for kids""), only ""computer"" will be taken into account for the products and categories autocomplete.","Standaard: Neen. Indien ingesteld op ""Ja"", wordt het extensiemechanisme genegeerd wanneer de door de gebruiker ingevoerde zoekterm een ​​van de populaire termensuggesties is. Bijv.: Wanneer de gebruiker klaar is met het typen van ""computer"", als de lijst met voorgestelde zoektermen (""computer"", ""perzik computer"", ""computer voor kinderen"") is, alleen ""computer"" Er wordt rekening gehouden met het automatisch aanvullen van producten en categorieën." diff --git a/src/module-elasticsuite-core/view/adminhtml/web/css/source/_module.less b/src/module-elasticsuite-core/view/adminhtml/web/css/source/_module.less index 620cca5bd..77866f91e 100644 --- a/src/module-elasticsuite-core/view/adminhtml/web/css/source/_module.less +++ b/src/module-elasticsuite-core/view/adminhtml/web/css/source/_module.less @@ -31,6 +31,10 @@ fieldset.radioset-tooltip { border-width: 1px 0; margin: @indent__l 0; padding: @indent__m; + + #row_smile_elasticsuite_autocomplete_settings_advanced_info & { + margin-top: 0; + } } &.config-comment-title { @@ -40,6 +44,7 @@ fieldset.radioset-tooltip { &.config-comment-content { line-height: @line-height__l; + font-size: 1.3rem; } }