Skip to content

Commit 88b245b

Browse files
committed
Entries should use their origin's value in search indexes where appropriate. Closes #2789
1 parent a0c7ad9 commit 88b245b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Search/Searchables.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ public function fields($searchable): array
159159
$transformers = $this->index->config()['transformers'] ?? [];
160160

161161
return collect($fields)->mapWithKeys(function ($field) use ($searchable) {
162-
$value = method_exists($searchable, $field) ? $searchable->{$field}() : $searchable->get($field);
162+
if (method_exists($searchable, $field)) {
163+
$value = $searchable->{$field}();
164+
} else {
165+
$value = $searchable instanceof EntryContract ? $searchable->value($field) : $searchable->get($field);
166+
}
163167

164168
return [$field => $value];
165169
})->flatMap(function ($value, $field) use ($transformers) {

0 commit comments

Comments
 (0)