Skip to content

Commit

Permalink
Merge pull request #3366 from rbayet/fix-3359-query-names-vs-fuzzines…
Browse files Browse the repository at this point in the history
…s-phonetic-disabled

[Core] Fixes #3359 Query name set error if fuzziness and phonetic disabled
  • Loading branch information
rbayet authored Sep 3, 2024
2 parents 3d4e742 + 9d71de0 commit 3d5fd47
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(
*
* @param ProductCondition $productCondition Product condition.
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
* @return QueryInterface
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function getSearchQuery(ProductCondition $productCondition)
Expand Down Expand Up @@ -134,7 +134,7 @@ public function getSearchQuery(ProductCondition $productCondition)
*
* @param ProductCondition $productCondition Product condition.
*
* @return NULL|\Smile\ElasticsuiteCore\Search\Request\QueryInterface
* @return QueryInterface|null
*/
private function getSpecialAttributesSearchQuery(ProductCondition $productCondition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function create(ContainerConfigurationInterface $containerConfig, array $
* @param array|string $condition Filter condition.
* @param string|null $currentPath Current nested path or null.
*
* @return QueryInterface
* @return QueryInterface|null
* @SuppressWarnings(PHPMD.ElseExpression)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
Expand Down Expand Up @@ -235,7 +235,7 @@ private function prepareCondition($condition)
* @param string $field Filter field.
* @param array $values Filter values.
*
* @return QueryInterface
* @return QueryInterface|null
*/
private function getCombinedTermsQuery($field, $values)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public function create(ContainerConfigurationInterface $containerConfig, $queryT
$query->setName('PURE_STOPWORDS');
} elseif (in_array($spellingType, $fuzzySpellingTypes)) {
$query = $this->getSpellcheckedQuery($containerConfig, $queryText, $spellingType, $boost);
$query->setName('SPELLCHECK');
if ($query !== null) {
$query->setName('SPELLCHECK');
}
}

if ($query === null) {
Expand Down Expand Up @@ -240,7 +242,7 @@ private function getPureStopwordsQuery(ContainerConfigurationInterface $containe
* @param string $spellingType The type of spellchecked applied.
* @param float $boost Boost of the created query.
*
* @return QueryInterface
* @return QueryInterface|null
*/
private function getSpellcheckedQuery(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost)
{
Expand Down Expand Up @@ -379,7 +381,7 @@ private function getWeightedFields(
* @param string $queryText The query text
* @param int $boost The boost applied to the span query
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
* @return QueryInterface|null
*/
private function getSpanQuery(ContainerConfigurationInterface $containerConfig, $queryText, $boost)
{
Expand Down
2 changes: 1 addition & 1 deletion src/module-elasticsuite-virtual-category/Model/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected function preparePreviewItems($products = []): array
/**
* Return the filter applied to the query.
*
* @return QueryInterface
* @return QueryInterface|null
*/
private function getQueryFilter(): ?QueryInterface
{
Expand Down

0 comments on commit 3d5fd47

Please sign in to comment.