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();
Updated 23 days ago