Skip to content

Commit 7b6668b

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-33275-2
2 parents 2d27824 + 5b2f325 commit 7b6668b

File tree

55 files changed

+3119
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3119
-305
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdvanceCatalogSearchBundleBySkuWithHyphenTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Bundle"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
3636
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
3737
</entity>
38+
<entity name="ApiSimpleProductWithNoSpace" type="product" extends="ApiSimpleProduct">
39+
<data key="name">TestFooBar</data>
40+
<data key="sku" unique="suffix">foobar</data>
41+
</entity>
3842
<entity name="ApiSimpleProductWithSpecCharInName" type="product" extends="ApiSimpleProduct">
3943
<data key="name">Pursuit Lumaflex&#38;trade; Tone Band</data>
4044
<data key="sku" unique="suffix">x&#38;trade;</data>
@@ -68,6 +72,9 @@
6872
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
6973
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
7074
</entity>
75+
<entity name="ProductForPartialSearch" extends="SimpleProduct" type="product">
76+
<data key="sku">partialTestSku</data>
77+
</entity>
7178
<entity name="ProductWithSpecialSymbols" extends="SimpleProduct" type="product">
7279
<data key="name">SimpleProduct -+~/\\&lt;&gt;\’“:*\$#@()!,.?`=%&amp;^</data>
7380
</entity>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontAdvanceCatalogSearchSimpleProductBySkuWithHyphenTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Catalog"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontAdvanceCatalogSearchVirtualProductBySkuWithHyphenTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group value="Catalog"/>
2020
<group value="SearchEngineElasticsearch"/>
2121
<skip>
22-
<issueId value="MC-21228"/>
22+
<issueId value="MC-34217"/>
2323
</skip>
2424
</annotations>
2525
<before>

app/code/Magento/CatalogCmsGraphQl/Model/Resolver/Category/Block.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Exception\LocalizedException;
1212
use Magento\Framework\Exception\NoSuchEntityException;
1313
use Magento\Framework\GraphQl\Config\Element\Field;
14+
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
1415
use Magento\Framework\GraphQl\Query\ResolverInterface;
1516
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1617
use Magento\CmsGraphQl\Model\Resolver\DataProvider\Block as BlockProvider;
@@ -48,18 +49,19 @@ public function resolve(
4849
}
4950
/** @var Category $category */
5051
$category = $value['model'];
51-
$blockId = $category->getLandingPage();
52+
$blockId = (int)$category->getLandingPage();
53+
$storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
5254

5355
if (empty($blockId)) {
5456
return null;
5557
}
5658

5759
try {
58-
$block = $this->blockProvider->getData($blockId);
60+
$blockData = $this->blockProvider->getBlockById($blockId, $storeId);
5961
} catch (NoSuchEntityException $e) {
60-
return null;
62+
return new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
6163
}
6264

63-
return $block;
65+
return $blockData;
6466
}
6567
}

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model
245245
level: Int @doc(description: "Indicates the depth of the category within the tree.")
246246
created_at: String @doc(description: "Timestamp indicating when the category was created.")
247247
updated_at: String @doc(description: "Timestamp indicating when the category was updated.")
248-
product_count: Int @doc(description: "The number of products in the category.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount")
248+
product_count: Int @doc(description: "The number of products in the category that are marked as visible. By default, in complex products, parent products are visible, but their child products are not.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount")
249249
default_sort_by: String @doc(description: "The attribute to use for sorting.")
250250
products(
251251
pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."),
@@ -299,7 +299,7 @@ type SimpleProduct implements ProductInterface, PhysicalProductInterface, Custom
299299
type Products @doc(description: "The Products object is the top-level object returned in a product search.") {
300300
items: [ProductInterface] @doc(description: "An array of products that match the specified search criteria.")
301301
page_info: SearchResultPageInfo @doc(description: "An object that includes the page_info and currentPage values specified in the query.")
302-
total_count: Int @doc(description: "The number of products returned.")
302+
total_count: Int @doc(description: "The number of products that are marked as visible. By default, in complex products, parent products are visible, but their child products are not.")
303303
filters: [LayerFilter] @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\LayerFilters") @doc(description: "Layered navigation filters array.") @deprecated(reason: "Use aggregations instead")
304304
aggregations: [Aggregation] @doc(description: "Layered navigation aggregations.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Aggregations")
305305
sort_fields: SortFields @doc(description: "An object that includes the default sort field and all available sort fields.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\SortFields")
@@ -308,7 +308,7 @@ type Products @doc(description: "The Products object is the top-level object ret
308308
type CategoryProducts @doc(description: "The category products object returned in the Category query.") {
309309
items: [ProductInterface] @doc(description: "An array of products that are assigned to the category.")
310310
page_info: SearchResultPageInfo @doc(description: "An object that includes the page_info and currentPage values specified in the query.")
311-
total_count: Int @doc(description: "The number of products returned.")
311+
total_count: Int @doc(description: "The number of products in the category that are marked as visible. By default, in complex products, parent products are visible, but their child products are not.")
312312
}
313313

314314
input ProductAttributeFilterInput @doc(description: "ProductAttributeFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.") {

app/code/Magento/CatalogGraphQl/etc/search_request.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<queries>
1616
<query xsi:type="boolQuery" name="graphql_product_search_with_aggregation" boost="1">
1717
<queryReference clause="should" ref="search" />
18+
<queryReference clause="should" ref="partial_search" />
1819
<queryReference clause="must" ref="category"/>
1920
<queryReference clause="must" ref="price"/>
2021
<queryReference clause="must" ref="visibility"/>
@@ -23,6 +24,11 @@
2324
<match field="sku"/>
2425
<match field="*"/>
2526
</query>
27+
<query xsi:type="matchQuery" value="$search_term$" name="partial_search">
28+
<match field="*"/>
29+
<match field="name" matchCondition="match_phrase_prefix"/>
30+
<match field="sku" matchCondition="match_phrase_prefix"/>
31+
</query>
2632
<query name="category" xsi:type="filteredQuery">
2733
<filterReference clause="must" ref="category_filter"/>
2834
</query>
@@ -61,6 +67,7 @@
6167
<queries>
6268
<query xsi:type="boolQuery" name="graphql_product_search" boost="1">
6369
<queryReference clause="should" ref="search" />
70+
<queryReference clause="should" ref="partial_search" />
6471
<queryReference clause="must" ref="category"/>
6572
<queryReference clause="must" ref="price"/>
6673
<queryReference clause="must" ref="visibility"/>
@@ -69,6 +76,11 @@
6976
<match field="sku"/>
7077
<match field="*"/>
7178
</query>
79+
<query xsi:type="matchQuery" value="$search_term$" name="partial_search">
80+
<match field="*"/>
81+
<match field="name" matchCondition="match_phrase_prefix"/>
82+
<match field="sku" matchCondition="match_phrase_prefix"/>
83+
</query>
7284
<query name="category" xsi:type="filteredQuery">
7385
<filterReference clause="must" ref="category_filter"/>
7486
</query>

app/code/Magento/CatalogSearch/Test/Mftf/Test/MinimalQueryLengthForCatalogSearchTest.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
<useCaseId value="MAGETWO-58764"/>
2020
<group value="CatalogSearch"/>
2121
<group value="SearchEngineElasticsearch"/>
22-
<skip>
23-
<issueId value="MC-21228"/>
24-
</skip>
22+
2523
</annotations>
2624
<before>
2725
<createData entity="ApiCategory" stepKey="createCategory"/>
28-
<createData entity="ApiSimpleProduct" stepKey="createProduct">
26+
<createData entity="productAlphabeticalB" stepKey="createProduct">
2927
<requiredEntity createDataKey="createCategory"/>
3028
</createData>
3129
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
@@ -39,7 +37,8 @@
3937
<actionGroup ref="SetMinimalQueryLengthActionGroup" stepKey="setMinQueryLength"/>
4038
<comment userInput="Go to Storefront and search for product" stepKey="searchProdUsingMinQueryLength"/>
4139
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
42-
<fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="s" stepKey="fillAttribute"/>
40+
<comment userInput="Quick search by single character and avoid using ES stopwords" stepKey="commentQuickSearch"/>
41+
<fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="B" stepKey="fillAttribute"/>
4342
<waitForPageLoad stepKey="waitForSearchTextBox"/>
4443
<click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/>
4544
<waitForPageLoad stepKey="waitForSearch"/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchProductByNameWithThreeLettersTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<group value="CatalogSearch"/>
1818
<group value="SearchEngineElasticsearch"/>
1919
<group value="mtf_migrated"/>
20-
<skip>
21-
<issueId value="MC-21228"/>
22-
</skip>
2320
</annotations>
2421
<executeJS function="var s = '$createSimpleProduct.name$'; var ret=s.substring(0,3); return ret;" stepKey="getFirstThreeLetters" before="searchStorefront"/>
2522
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront">

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchTwoProductsWithSameWeightTest.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<group value="CatalogSearch"/>
1818
<group value="SearchEngineElasticsearch"/>
1919
<group value="mtf_migrated"/>
20-
<skip>
21-
<issueId value="MC-21228"/>
22-
</skip>
2320
</annotations>
2421
<before>
2522
<createData entity="_defaultCategory" stepKey="createCategory"/>
@@ -31,7 +28,6 @@
3128
</createData>
3229
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
3330

34-
3531
<!-- Create and Assign Attribute to product1-->
3632
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProduct1">
3733
<argument name="productId" value="$product1.id$"/>
@@ -79,18 +75,19 @@
7975
<deleteData stepKey="deleteProduct1" createDataKey="product1"/>
8076
<deleteData stepKey="deleteProduct2" createDataKey="product2"/>
8177
<deleteData stepKey="deleteCategory" createDataKey="createCategory"/>
78+
8279
</after>
8380
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/>
8481
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront">
8582
<argument name="phrase" value="{{_defaultProduct.name}}"/>
8683
</actionGroup>
8784
<actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct1Position">
8885
<argument name="productName" value="$product1.name$"/>
89-
<argument name="index" value="2"/>
86+
<argument name="index" value="1"/>
9087
</actionGroup>
9188
<actionGroup ref="StorefrontQuickSearchCheckProductNameInGridActionGroup" stepKey="assertProduct2Position">
9289
<argument name="productName" value="$product2.name$"/>
93-
<argument name="index" value="1"/>
90+
<argument name="index" value="2"/>
9491
</actionGroup>
9592
</test>
9693
</tests>

0 commit comments

Comments
 (0)