Skip to content

Commit

Permalink
Address fields can be added to the search index
Browse files Browse the repository at this point in the history
  • Loading branch information
lindseydiloreto committed Oct 17, 2023
1 parent fcb7c68 commit f123fe1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Added
- Address fields can now be added to the search index. ([#21](https://github.com/doublesecretagency/craft-googlemaps/issues/21))
- Optionally use minified JavaScript files for dynamic maps on the front-end. ([#98](https://github.com/doublesecretagency/craft-googlemaps/issues/98))

## 4.3.6 - 2023-09-18
Expand Down
23 changes: 23 additions & 0 deletions src/fields/AddressField.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,29 @@ public function modifyElementsQuery(ElementQueryInterface $query, mixed $value):
ProximitySearchHelper::modifyElementsQuery($query, $value, $this);
}

// ========================================================================= //

/**
* @inheritdoc
*/
public function getSearchKeywords(mixed $value, ElementInterface $element): string
{
/** @var AddressModel $value */
return implode(' ', [
$value->name,
$value->street1,
$value->street2,
$value->city,
$value->state,
$value->zip,
$value->county,
$value->country,
$value->formatted,
]);
}

// ========================================================================= //

/**
* @inheritdoc
*/
Expand Down

0 comments on commit f123fe1

Please sign in to comment.