Skip to content

Commit af229f6

Browse files
author
Prabhu Ram
committed
MC-21228: Support partial word search in Elasticsearch
- Fixed static failures
1 parent f80bb04 commit af229f6

File tree

2 files changed

+45
-17
lines changed

2 files changed

+45
-17
lines changed

app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/MatchTest.php

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ protected function setUp(): void
8686
* @param array $expected
8787
* @param string|null $minimumShouldMatch
8888
* @dataProvider buildDataProvider
89+
* @dataProvider buildDataProviderForMatchPhrasePrefix
8990
*/
9091
public function testBuild(
9192
string $searchQuery,
@@ -202,29 +203,57 @@ public function buildDataProvider(): array
202203
],
203204
'2<75%'
204205
],
205-
'match_phrase_prefix query with minimum_should_match' => [
206-
'"fitness bottle"',
206+
207+
];
208+
}
209+
210+
/**
211+
* @return array
212+
*/
213+
public function buildDataProviderForMatchPhrasePrefix()
214+
{
215+
return [
216+
'match_phrase_prefix query with minimum_should_match' => [
217+
'"fitness bottle"',
218+
[
207219
[
208-
[
209-
'field' => 'name',
210-
'boost' => 5,
211-
'matchCondition' => 'match_phrase_prefix'
212-
]
220+
'field' => 'name',
221+
'boost' => 5,
222+
'matchCondition' => 'match_phrase_prefix'
223+
]
224+
],
225+
[
226+
[
227+
'match_phrase_prefix' => [
228+
'name' => [
229+
'query' => 'fitness bottle',
230+
'boost' => 6
231+
],
232+
],
213233
],
234+
],
235+
'2<75%'
236+
],
237+
'match_phrase_prefix query with no minimum_should_match' => [
238+
'"fitness bottle"',
239+
[
214240
[
215-
[
216-
'match_phrase_prefix' => [
217-
'name' => [
218-
'query' => 'fitness bottle',
219-
'boost' => 6,
220-
'minimum_should_match' => '2<75%',
221-
],
241+
'field' => 'name',
242+
'boost' => 5,
243+
'matchCondition' => 'match_phrase_prefix'
244+
]
245+
],
246+
[
247+
[
248+
'match_phrase_prefix' => [
249+
'name' => [
250+
'query' => 'fitness bottle',
251+
'boost' => 6
222252
],
223253
],
224254
],
225-
'2<75%'
226255
]
227-
];
256+
]];
228257
}
229258

230259
/**

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,6 @@ public function testProductPartialNameFullTextSearchQuery()
18661866

18671867
$prod1 = $productRepository->get('simple1');
18681868
$prod2 = $productRepository->get('simple2');
1869-
$prod3 = $productRepository->get('simple3');
18701869
$response = $this->graphQlQuery($query);
18711870
$this->assertEquals(2, $response['products']['total_count']);
18721871

0 commit comments

Comments
 (0)