Facet range

Feature

Create a facet range

How to

  1. 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();
  1. 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();
  1. Read data

Settings

Use case

How to

Sort type of result of facet

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.SortType = FacetSortType.CountAsc)

Minimum count of itens in facet's result

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.Minimum = 2)

Limit of itens in facet's result

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.Limit = 10)

List of tags to exclude in facet calculation

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.Excludes = new[] { "tag1", "tag2" })

Counts should also be computed for all records with field values lower then lower bound of the first range

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.CountBefore = true)

Counts should also be computed for all records with field values greater then the upper bound of the last range

.FacetRange("AliasName", q => q.Price, "1", "10", "100", facet => facet.CountAfter = true)

Last updated

Was this helpful?