Skip to content

Commit 7b7c8b1

Browse files
authoredApr 5, 2024
Update search.md (statamic#1250)
1 parent dc889d1 commit 7b7c8b1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎content/collections/docs/search.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ Each transformer is a closure that would correspond to a field in your index's `
161161

162162
// Return an array of values to be stored.
163163
// These will all be separate searchable fields in the index.
164-
'address' => function ($address) {
164+
// $value is the current value
165+
// $searchable is the object that $value has been plucked from
166+
'address' => function ($value, $searchable) {
165167
return [
166-
'_geoloc' => $address['geolocation'],
167-
'location' => $address['location'],
168-
'region' => $address['region'],
168+
'_geoloc' => $value['geolocation'],
169+
'location' => $value['location'],
170+
'region' => $value['region'],
169171
];
170172
}
171173
]
@@ -189,7 +191,7 @@ class MyTransformer
189191
{
190192
// $value is the current value
191193
// $field is the index from the transformers array
192-
// $searchable is the class that $value has been plucked from
194+
// $searchable is the object that $value has been plucked from
193195

194196
return ucfirst($value);
195197
}

0 commit comments

Comments
 (0)
Please sign in to comment.