Facet range
Feature
Create a facet range
How to
Configure facet
DocumentCollection<TechProductDocument> documentCollection; // from DI
var rersult = documentCollection
.Select()
// gap: "1", start: "10", end: "100"
.FacetRange("AliasName", q => q.Price, "1", "10", "100")
.Execute();
Optionally, change one or more settings
DocumentCollection<TechProductDocument> documentCollection; // from DI
var rersult = documentCollection
.Select()
.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet =>
{
facet.Minimum = 3;
facet.Limit = 5;
})
.Execute();
Read data
rersult
.Facets(out var data);
foreach (FacetItemRange facetItem in data)
{
// facetName = "AliasName"
var facetName = facetItem.Name;
//facetType = FacetType.Range
var facetType = facetItem.FacetType;
foreach (FacetItemRangeValue<decimal> facetItemValue in facetItem.Values)
{
// nested = nested facet (if configured)
var nested = facetItemValue.Facets;
// minimumValue = minimum value of item
var minimumValue = facetItemValue.MinimumValue;
// maximumValue = maximum value of item
var maximumValue = facetItemValue.MaximumValue;
// quantity = quantity of item's value
var quantity = facetItemValue.Quantity;
}
}
Settings
Last updated