Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add untouched analyzer for text promo rules & exact match rule conditions #3230

Open
wants to merge 2 commits into
base: 2.11.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function getDefaultOperatorInputByType()
{
if (null === $this->_defaultOperatorInputByType) {
$this->_defaultOperatorInputByType = [
'string' => ['{}', '!{}'],
'string' => ['==', '!=', '{}', '!{}'],
'numeric' => ['==', '!=', '>=', '>', '<=', '<'],
'date' => ['==', '>=', '>', '<=', '<'],
'select' => ['==', '!='],
Expand Down
4 changes: 4 additions & 0 deletions src/module-elasticsuite-catalog/Helper/AbstractAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public function getMappingFieldOptions(AttributeInterface $attribute)
$options['is_filterable'] = true;
}

if ($attribute->getIsUsedForPromoRules()) {
$options['is_used_for_promo_rules'] = true;
}

if ($attribute->getUsedForSortBy()) {
$options['sort_order_asc_missing'] = $attribute->getSortOrderAscMissing();
$options['sort_order_desc_missing'] = $attribute->getSortOrderDescMissing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public function isSearchableEdgeNgram();
*/
public function isFilterable();

/**
* Is the attribute used for promo rules.
*/
public function isUsedForPromoRules();

/**
* Is the attribute used in sorting.
*/
Expand Down
11 changes: 10 additions & 1 deletion src/module-elasticsuite-core/Index/Mapping/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Field implements FieldInterface
'is_filterable' => true,
'is_used_for_sort_by' => false,
'is_used_in_spellcheck' => false,
'is_used_for_promo_rules' => false,
'search_weight' => 1,
'default_search_analyzer' => self::ANALYZER_STANDARD,
'filter_logical_operator' => self::FILTER_LOGICAL_OPERATOR_OR,
Expand Down Expand Up @@ -142,6 +143,14 @@ public function isFilterable(): bool
return (bool) $this->config['is_filterable'];
}

/**
* {@inheritDoc}
*/
public function isUsedForPromoRules(): bool
{
return (bool) $this->config['is_used_for_promo_rules'];
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -388,7 +397,7 @@ private function getFieldAnalyzers(): array
$analyzers[] = self::ANALYZER_SHINGLE;
}

if (empty($analyzers) || $this->isFilterable()) {
if (empty($analyzers) || $this->isFilterable() || $this->isUsedForPromoRules()) {
// For filterable fields or fields without analyzer : append the untouched analyzer.
$analyzers[] = self::ANALYZER_UNTOUCHED;
}
Expand Down
Loading