Skip to content

Commit e3230c9

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-91750' into EPAM-PR-30
2 parents f0f7c39 + f546c77 commit e3230c9

File tree

2 files changed

+33
-2
lines changed
  • app/code/Magento/CatalogSearch/Model/ResourceModel
  • dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action

2 files changed

+33
-2
lines changed

app/code/Magento/CatalogSearch/Model/ResourceModel/Engine.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ public function processAttributeValue($attribute, $value)
110110
&& in_array($attribute->getFrontendInput(), ['text', 'textarea'])
111111
) {
112112
$result = $value;
113-
} elseif ($this->isTermFilterableAttribute($attribute)) {
113+
} elseif ($this->isTermFilterableAttribute($attribute)
114+
|| ($attribute->getIsSearchable() && in_array($attribute->getFrontendInput(), ['select', 'multiselect']))
115+
) {
114116
$result = '';
115117
}
116118

@@ -119,6 +121,7 @@ public function processAttributeValue($attribute, $value)
119121

120122
/**
121123
* Prepare index array as a string glued by separator
124+
*
122125
* Support 2 level array gluing
123126
*
124127
* @param array $index

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/FullTest.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@
1414
use Magento\Catalog\Model\Product;
1515
use Magento\TestFramework\Helper\Bootstrap;
1616

17+
/**
18+
* Class for testing fulltext index rebuild
19+
*/
1720
class FullTest extends \PHPUnit\Framework\TestCase
1821
{
1922
/**
2023
* @var \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full
2124
*/
2225
protected $actionFull;
2326

27+
/**
28+
* @inheritdoc
29+
*/
2430
protected function setUp()
2531
{
2632
$this->actionFull = Bootstrap::getObjectManager()->create(
@@ -29,6 +35,8 @@ protected function setUp()
2935
}
3036

3137
/**
38+
* Testing fulltext index rebuild
39+
*
3240
* @magentoDataFixture Magento/CatalogSearch/_files/products_for_index.php
3341
* @magentoDataFixture Magento/CatalogSearch/_files/product_configurable_not_available.php
3442
* @magentoDataFixture Magento/Framework/Search/_files/product_configurable.php
@@ -39,7 +47,6 @@ public function testGetIndexData()
3947
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
4048
$allowedStatuses = Bootstrap::getObjectManager()->get(Status::class)->getVisibleStatusIds();
4149
$allowedVisibility = Bootstrap::getObjectManager()->get(Engine::class)->getAllowedVisibility();
42-
4350
$result = iterator_to_array($this->actionFull->rebuildStoreIndex(Store::DISTRO_STORE_ID));
4451
$this->assertNotEmpty($result);
4552

@@ -58,7 +65,10 @@ public function testGetIndexData()
5865
}
5966

6067
/**
68+
* Prepare and return expected index data
69+
*
6170
* @return array
71+
* @throws \Magento\Framework\Exception\NoSuchEntityException
6272
*/
6373
private function getExpectedIndexData()
6474
{
@@ -68,32 +78,48 @@ private function getExpectedIndexData()
6878
$nameId = $attributeRepository->get(ProductInterface::NAME)->getAttributeId();
6979
/** @see dev/tests/integration/testsuite/Magento/Framework/Search/_files/configurable_attribute.php */
7080
$configurableId = $attributeRepository->get('test_configurable')->getAttributeId();
81+
$statusId = $attributeRepository->get(ProductInterface::STATUS)->getAttributeId();
82+
$taxClassId = $attributeRepository
83+
->get(\Magento\Customer\Api\Data\GroupInterface::TAX_CLASS_ID)
84+
->getAttributeId();
7185
return [
7286
'configurable' => [
7387
$skuId => 'configurable',
7488
$configurableId => 'Option 1 | Option 2',
7589
$nameId => 'Configurable Product | Configurable OptionOption 1 | Configurable OptionOption 2',
90+
$taxClassId => 'Taxable Goods | Taxable Goods | Taxable Goods',
91+
$statusId => 'Enabled | Enabled | Enabled'
7692
],
7793
'index_enabled' => [
7894
$skuId => 'index_enabled',
7995
$nameId => 'index enabled',
96+
$taxClassId => 'Taxable Goods',
97+
$statusId => 'Enabled'
8098
],
8199
'index_visible_search' => [
82100
$skuId => 'index_visible_search',
83101
$nameId => 'index visible search',
102+
$taxClassId => 'Taxable Goods',
103+
$statusId => 'Enabled'
84104
],
85105
'index_visible_category' => [
86106
$skuId => 'index_visible_category',
87107
$nameId => 'index visible category',
108+
$taxClassId => 'Taxable Goods',
109+
$statusId => 'Enabled'
88110
],
89111
'index_visible_both' => [
90112
$skuId => 'index_visible_both',
91113
$nameId => 'index visible both',
114+
$taxClassId => 'Taxable Goods',
115+
$statusId => 'Enabled'
92116
]
93117
];
94118
}
95119

96120
/**
121+
* Testing fulltext index rebuild with configurations
122+
*
97123
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
98124
*/
99125
public function testRebuildStoreIndexConfigurable()
@@ -114,6 +140,8 @@ public function testRebuildStoreIndexConfigurable()
114140
}
115141

116142
/**
143+
* Get product Id by its SKU
144+
*
117145
* @param string $sku
118146
* @return int
119147
*/

0 commit comments

Comments
 (0)