Skip to content

Commit

Permalink
Merge branch '4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Oct 16, 2023
2 parents 0ef85fa + 11e30fe commit b40f6e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10370,16 +10370,6 @@ parameters:
count: 1
path: src/lib/FieldType/Time/Value.php

-
message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Unindexed\\:\\:getDefaultMatchField\\(\\) should return string but returns null\\.$#"
count: 1
path: src/lib/FieldType/Unindexed.php

-
message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Unindexed\\:\\:getDefaultSortField\\(\\) should return string but returns null\\.$#"
count: 1
path: src/lib/FieldType/Unindexed.php

-
message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\Value\\:\\:\\$text\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/FieldType/Indexable.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getIndexDefinition();
* implementation of this interface), this method is used to define default
* field for matching. Default field is typically used by Field criterion.
*
* @return string
* @return string|null
*/
public function getDefaultMatchField();

Expand All @@ -50,7 +50,7 @@ public function getDefaultMatchField();
* implementation of this interface), this method is used to define default
* field for sorting. Default field is typically used by Field sort clause.
*
* @return string
* @return string|null
*/
public function getDefaultSortField();
}
Expand Down
8 changes: 3 additions & 5 deletions src/lib/FieldType/Unindexed.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition;

/**
* Indexable definition for string field type.
* Empty implementation of \Ibexa\Contracts\Core\FieldType\Indexable.
*
* Used when field type doesn't contribute to search index.
*/
class Unindexed implements Indexable
{
Expand All @@ -31,8 +33,6 @@ public function getIndexDefinition()
* As field types can index multiple fields (see MapLocation field type's
* implementation of this interface), this method is used to define default
* field for matching. Default field is typically used by Field criterion.
*
* @return string
*/
public function getDefaultMatchField()
{
Expand All @@ -45,8 +45,6 @@ public function getDefaultMatchField()
* As field types can index multiple fields (see MapLocation field type's
* implementation of this interface), this method is used to define default
* field for sorting. Default field is typically used by Field sort clause.
*
* @return string
*/
public function getDefaultSortField()
{
Expand Down
6 changes: 6 additions & 0 deletions src/lib/Search/Common/FieldNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ public function getIndexFieldName(
$indexDefinition = $indexFieldType->getIndexDefinition();

// Should only happen by mistake, so let's throw if it does
if ($name === null) {
throw new RuntimeException(
"Undefined default sort or match field in '{$fieldTypeIdentifier}' Field Type's index definition"
);
}

if (!isset($indexDefinition[$name])) {
throw new RuntimeException(
"Could not find Field '{$name}' in '{$fieldTypeIdentifier}' Field Type's index definition"
Expand Down

0 comments on commit b40f6e7

Please sign in to comment.