Skip to content

Commit

Permalink
Entries should use their origin's value in search indexes where appro…
Browse files Browse the repository at this point in the history
…priate. Closes #2789
  • Loading branch information
jasonvarga committed Nov 5, 2020
1 parent a0c7ad9 commit 88b245b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Search/Searchables.php
Expand Up @@ -159,7 +159,11 @@ public function fields($searchable): array
$transformers = $this->index->config()['transformers'] ?? [];

return collect($fields)->mapWithKeys(function ($field) use ($searchable) {
$value = method_exists($searchable, $field) ? $searchable->{$field}() : $searchable->get($field);
if (method_exists($searchable, $field)) {
$value = $searchable->{$field}();
} else {
$value = $searchable instanceof EntryContract ? $searchable->value($field) : $searchable->get($field);
}

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

0 comments on commit 88b245b

Please sign in to comment.