1. Classes

GeoWithinFilter

Version:
TypeClass
ExtendsBaseFilter
Import path@sitecore-cloudsdk/search/browser

A filter that returns search results depending on geographical data, such as an area defined by polygon area coordinates.

The coordinates form the polygonal area where Sitecore Search looks for search results.

latitude and longitude define one vertex of the polygon. For example, if you define four vertexes, Sitecore Search creates a four-sided area to filter results within.

Constructor

GeoWithinFilter(
  attributeName: string,
  geoWithinFilterData: GeoWithinFilterData
)

Parameters

NameTypeDescription
attributeNamestringThe entity's attribute to match against the geographical data.

Example: "location"
geoWithinFilterDataGeoWithinFilterDataAn array of geographical coordinates. Used for filtering search results.

Minimum length: 3.

Properties

NameTypeDescription
_attributeNamestringRequired.

The entity's attribute to match against the geographical data.

Methods

_validateLocation

Validates latitude and longitude.

Signature

private _validateLocation(location: LocationData): void

Parameters

NameTypeDescription
locationLocationDataThe geographical coordinates of the location that the site visitor wants to see search results for.

Overrides the site visitor's current location (geoData.location).

Return value

Returns void.

Errors

toDTO

Maps the GeoWithinFilter instance to its DTO (data transfer object) format.

Signature

toDTO(): GeoWithinFilterDTO

Return value

Returns the GeoWithinFilter instance in a standardized DTO format.

If you have suggestions for improving this article, let us know!