| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace Azure.Search.Documents.Models |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// A single bucket of a range facet query result that reports the number |
| | | 10 | | /// of documents with a field value falling within a particular range. |
| | | 11 | | /// </summary> |
| | | 12 | | /// <typeparam name="T"> |
| | | 13 | | /// A type that matches the type of the field to which the facet was |
| | | 14 | | /// applied. Valid types include <see cref="DateTimeOffset"/>, |
| | | 15 | | /// <see cref="Double"/>, and <see cref="Int64"/>. |
| | | 16 | | /// </typeparam> |
| | | 17 | | public class RangeFacetResult<T> where T : struct |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the approximate count of documents falling within the bucket |
| | | 21 | | /// described by this facet. |
| | | 22 | | /// </summary> |
| | 4 | 23 | | public long Count { get; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets a value indicating the inclusive lower bound of the facet's |
| | | 27 | | /// range, or <c>null</c> to indicate that there is no lower bound |
| | | 28 | | /// (for the first bucket). |
| | | 29 | | /// </summary> |
| | 4 | 30 | | public T? From { get; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets a value indicating the exclusive upper bound of the facet's |
| | | 34 | | /// range, or <c>null</c> to indicate that there is no upper bound |
| | | 35 | | /// (for the last bucket). |
| | | 36 | | /// </summary> |
| | 6 | 37 | | public T? To { get; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Creates a new instance of the RangeFacetResult class. |
| | | 41 | | /// </summary> |
| | | 42 | | /// <param name="count"> |
| | | 43 | | /// The approximate count of documents falling within the bucket |
| | | 44 | | /// described by this facet. |
| | | 45 | | /// </param> |
| | | 46 | | /// <param name="from"> |
| | | 47 | | /// A value indicating the inclusive lower bound of the facet's range, |
| | | 48 | | /// or <c>null</c> to indicate that there is no lower bound (for the |
| | | 49 | | /// first bucket). |
| | | 50 | | /// </param> |
| | | 51 | | /// <param name="to"> |
| | | 52 | | /// A value indicating the exclusive upper bound of the facet's range, |
| | | 53 | | /// or <c>null</c> to indicate that there is no upper bound (for the |
| | | 54 | | /// last bucket). |
| | | 55 | | /// </param> |
| | 6 | 56 | | public RangeFacetResult(long count, T? from, T? to) |
| | | 57 | | { |
| | 6 | 58 | | From = from; |
| | 6 | 59 | | To = to; |
| | 6 | 60 | | Count = count; |
| | 6 | 61 | | } |
| | | 62 | | } |
| | | 63 | | } |