HomeDev GuideRecipesAPI ReferenceGraphQL
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


Facets are used to group documents based on some criteria, for example 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 via the `GeoDistanceFacetFor` method.

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

Assume you indexed a number of restaurants as instance of this class:



Request the number of restaurants within 1, 5, and 10 kilometers of a location via 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.