improve docs

This commit is contained in:
Pascal Seitz
2022-03-16 12:39:26 +08:00
parent e73542e2e8
commit 0b6d9f90cf
3 changed files with 25 additions and 12 deletions

View File

@@ -90,7 +90,7 @@ pub enum BucketResult {
///
/// If there are holes depends on the request, if min_doc_count is 0, then there are no
/// holes between the first and last bucket.
/// See [HistogramAggregation](super::agg_request::HistogramAggregation)
/// See [HistogramAggregation](super::bucket::HistogramAggregation)
buckets: Vec<BucketEntry>,
},
}
@@ -161,7 +161,7 @@ impl From<IntermediateBucketResult> for BucketResult {
/// sub_aggregations.
///
/// # JSON Format
/// ```ignore
/// ```json
/// {
/// ...
/// "my_histogram": {
@@ -182,7 +182,7 @@ impl From<IntermediateBucketResult> for BucketResult {
/// }
/// ...
/// }
/// ```
/// ```
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BucketEntry {
/// The identifier of the bucket.
@@ -208,7 +208,7 @@ impl From<IntermediateHistogramBucketEntry> for BucketEntry {
/// sub_aggregations.
///
/// # JSON Format
/// ```ignore
/// ```json
/// {
/// ...
/// "my_ranges": {
@@ -233,7 +233,7 @@ impl From<IntermediateHistogramBucketEntry> for BucketEntry {
/// }
/// ...
/// }
/// ```
/// ```
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RangeBucketEntry {
/// The identifier of the bucket.

View File

@@ -34,7 +34,7 @@ use crate::{DocId, TantivyError};
///
/// # Result
/// Result type is [BucketResult](crate::aggregation::agg_result::BucketResult) with
/// [RangeBucketEntry](crate::aggregation::agg_result::BucketEntry) on the
/// [BucketEntry](crate::aggregation::agg_result::BucketEntry) on the
/// AggregationCollector.
///
/// Result type is
@@ -42,8 +42,12 @@ use crate::{DocId, TantivyError};
/// [crate::aggregation::intermediate_agg_result::IntermediateHistogramBucketEntry] on the
/// DistributedAggregationCollector.
///
/// # Request JSON Format
/// ```ignore
/// # Limitations/Compatibility
///
/// The keyed parameter (elasticsearch) is not yet supported.
///
/// # JSON Format
/// ```json
/// {
/// "prices": {
/// "histogram": {
@@ -52,7 +56,11 @@ use crate::{DocId, TantivyError};
/// }
/// }
/// }
/// ```
/// ```
///
/// Response
/// See [BucketEntry](crate::aggregation::agg_result::BucketEntry)
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct HistogramAggregation {
/// The field to aggregate on.

View File

@@ -30,8 +30,13 @@ use crate::{DocId, TantivyError};
/// [crate::aggregation::intermediate_agg_result::IntermediateRangeBucketEntry] on the
/// DistributedAggregationCollector.
///
/// # Limitations/Compatibility
/// Overlapping ranges are not yet supported.
///
/// The keyed parameter (elasticsearch) is not yet supported.
///
/// # Request JSON Format
/// ```ignore
/// ```json
/// {
/// "range": {
/// "field": "score",
@@ -42,8 +47,8 @@ use crate::{DocId, TantivyError};
/// { "from": 20.0 }
/// ]
/// }
/// }
/// ```
/// }
/// ```
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RangeAggregation {
/// The field to aggregate on.