GeoFilter

Version:

Type

Class

Extends

BaseFilter

Import path

@sitecore-cloudsdk/search/browser

A filter that returns search results depending on geographical data, such as the radius of a circular geographical area.

For example, return search results only for those products that are available for purchase within "16km" of where the search request was made.

Constructor

GeoFilter(
  attributeName: string,
  geoFilterData: GeoFilterData
)

Parameters

Name

Type

Description

attributeName

string

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

Example: "location"

geoFilterData

GeoFilterData

Geographical data used for filtering search results.

Properties

Name

Type

Description

_attributeName

string

Required.

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

Methods

_validateLocation

Validates latitude and longitude.

Signature

private _validateLocation(location: LocationData): void

Parameters

Name

Type

Description

location

LocationData

The 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 GeoFilter instance to its DTO (data transfer object) format.

Signature

toDTO(): GeoFilterDTO

Return value

Returns the GeoFilter instance in a standardized DTO format.

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