Skip to content

Commit 5e33bc5

Browse files
committed
ACP2E-464: Remove wildcard and LIKE operator and replace with equal operator in customer grid filter search
1 parent 026fd48 commit 5e33bc5

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

app/code/Magento/Customer/Model/Indexer/AttributeProvider.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Customer\Model\Indexer;
77

8+
use Magento\Customer\Model\Config\Source\FilterConditionType;
89
use Magento\Customer\Model\Customer;
910
use Magento\Framework\Indexer\FieldsetInterface;
1011
use Magento\Eav\Model\Config;
@@ -15,7 +16,7 @@ class AttributeProvider implements FieldsetInterface
1516
/**
1617
* EAV entity
1718
*/
18-
const ENTITY = Customer::ENTITY;
19+
public const ENTITY = Customer::ENTITY;
1920

2021
/**
2122
* @var Attribute[]
@@ -97,11 +98,15 @@ protected function convert(array $attributes, array $fieldset)
9798
'bind' => isset($fieldset['references']['customer']['to'])
9899
? $fieldset['references']['customer']['to']
99100
: null,
101+
'index' => $attribute->canBeFilterableInGrid()
102+
&& (int) $attribute->getGridFilterConditionType() === FilterConditionType::FULL_MATCH
100103
];
101104
}
102105
} else {
103106
$fields[$attribute->getName()] = [
104107
'type' => $this->getType($attribute),
108+
'index' => $attribute->canBeFilterableInGrid()
109+
&& (int) $attribute->getGridFilterConditionType() === FilterConditionType::FULL_MATCH
105110
];
106111
}
107112
}

lib/internal/Magento/Framework/Indexer/GridStructure.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ public function __construct(
5252
}
5353

5454
/**
55-
* @param string $index
56-
* @param Dimension[] $dimensions
57-
* @return void
55+
* @inheritdoc
5856
*/
5957
public function delete($index, array $dimensions = [])
6058
{
@@ -66,17 +64,16 @@ public function delete($index, array $dimensions = [])
6664
}
6765

6866
/**
69-
* @param string $index
70-
* @param array $fields
71-
* @param Dimension[] $dimensions
72-
* @return void
67+
* @inheritdoc
7368
*/
7469
public function create($index, array $fields, array $dimensions = [])
7570
{
7671
$this->createFlatTable($this->flatScopeResolver->resolve($index, $dimensions), $fields);
7772
}
7873

7974
/**
75+
* Creates index table with provided fields configuration
76+
*
8077
* @param string $tableName
8178
* @param array $fields
8279
* @throws \Zend_Db_Exception
@@ -104,7 +101,7 @@ protected function createFlatTable($tableName, array $fields)
104101
$name = $field['name'];
105102
$type = $columnMap['type'];
106103
$size = $columnMap['size'];
107-
if ($field['type'] === 'filterable') {
104+
if ($field['type'] === 'filterable' || (isset($field['index']) && $field['index'] === true)) {
108105
$table->addIndex(
109106
$this->resource->getIdxName($tableName, $name, AdapterInterface::INDEX_TYPE_INDEX),
110107
$name,
@@ -126,6 +123,8 @@ protected function createFlatTable($tableName, array $fields)
126123
}
127124

128125
/**
126+
* Returns an instance of the db connection
127+
*
129128
* @return false|AdapterInterface
130129
*/
131130
private function getAdapter()

0 commit comments

Comments
 (0)