HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Facets group documents based on criteria, such as specific terms or date range. 

Geographic distance facets group documents with a `GeoLocation` type property by distance from a location. Geographical distance facets are requested of, and extracted from, search results with the `GeoDistanceFacetFor` method.

Geographic distance facets need several ranges into which to group documents. Use the `NumericRange` class to do this.

Assume you indexed several restaurants as an instance of this class:

Request the number of restaurants within 1, 5, and 10 kilometers of a location with the `GeoDistanceFacetFor` method, as shown below.

To extract the facet from the results variable, use the `GeoDistanceFor` method (same name as the method used to retrieve facets). This returns an instance of the `GeoDistanceFacet` class, which contains an instance of the `GeoDistanceRangeResult` per requested range.