Skip to content

Commit 0738891

Browse files
committed
Fixed processing null values in fulltext function when field does not exists
1 parent c48dd82 commit 0738891

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [2.0.4]
4+
5+
- Fixed processing of fulltext function when value of selected field is `null`
6+
37
## [2.0.3]
48

59
- Fixed tokenization when using zero compare value

src/Functions/String/Fulltext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __invoke(array $item, array $resultItem): float|int
4040
$terms = $this->splitQuery($this->query);
4141
foreach ($this->fields as $index => $field) {
4242
$field = trim($field);
43-
$fieldValue = $this->getFieldValue($field, $item, $resultItem);
43+
$fieldValue = $this->getFieldValue($field, $item, $resultItem) ?? '';
4444
$weight = 1 / ($index + 1); // Weight by field order (lower index = higher weight).
4545
$score += $this->mode->calculate($this->extractPlainText($fieldValue), $terms) * $weight;
4646
}

0 commit comments

Comments
 (0)