HomeDev guideAPI ReferenceGraphQL
Dev guideUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Facets selection

Select facet by field.

The Optimizely Graph .Net Client supports faceting or aggregating documents using the Facet method. You must specify the field or fields you want to facet.

๐Ÿ‘

Beta

The Optimizely Graph .NET Client is in beta. Contact your Customer Success Manager for information.

The following is an example of a simple "facet" that facets the documents based on the value of the FacetProperty field:

var query = queryBuilder
.ForType<MyDocumentType>()
  .Facets(x=>x.FacetProperty)
.ToQuery()
.BuildQueries();

Facet projection

By default, the result of the facet contains a Name and Count field. Use the Projection method on IFilterOperator to get your desired field.

var stringFacetFilter = new StringFacetFilterOperator()
  .Filters(โ€œvalue1โ€,โ€value2โ€)
  .Limit(10)
  .OrderBy(x=>x.Property1, OrderMode.DESC)
  .Projection(FacetProperty.Name); //get only facet name

var query = queryBuilder
.ForType<NewsPage>()
  .Facet(x=>x.Title, stringFacetFilter)
.ToQuery()
.BuildQueries();