github.com/weaviate/weaviate@v1.24.6/entities/aggregation/result.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package aggregation
    13  
    14  type Result struct {
    15  	Groups []Group `json:"groups"`
    16  }
    17  
    18  type Group struct {
    19  	Properties map[string]Property `json:"properties"`
    20  	GroupedBy  *GroupedBy          `json:"groupedBy"` // optional to support ungrouped aggregations (formerly meta)
    21  	Count      int                 `json:"count"`
    22  }
    23  
    24  type Property struct {
    25  	Type                  PropertyType           `json:"type"`
    26  	NumericalAggregations map[string]interface{} `json:"numericalAggregations"`
    27  	TextAggregation       Text                   `json:"textAggregation"`
    28  	BooleanAggregation    Boolean                `json:"booleanAggregation"`
    29  	SchemaType            string                 `json:"schemaType"`
    30  	ReferenceAggregation  Reference              `json:"referenceAggregation"`
    31  	DateAggregations      map[string]interface{} `json:"dateAggregation"`
    32  }
    33  
    34  type Text struct {
    35  	Items []TextOccurrence `json:"items"`
    36  	Count int              `json:"count"`
    37  }
    38  
    39  type PropertyType string
    40  
    41  const (
    42  	PropertyTypeNumerical PropertyType = "numerical"
    43  	PropertyTypeBoolean   PropertyType = "boolean"
    44  	PropertyTypeText      PropertyType = "text"
    45  	PropertyTypeDate      PropertyType = "date"
    46  	PropertyTypeReference PropertyType = "cref"
    47  )
    48  
    49  type GroupedBy struct {
    50  	Value interface{} `json:"value"`
    51  	Path  []string    `json:"path"`
    52  }
    53  
    54  type TextOccurrence struct {
    55  	Value  string `json:"value"`
    56  	Occurs int    `json:"occurs"`
    57  }
    58  
    59  type Boolean struct {
    60  	Count           int     `json:"count"`
    61  	TotalTrue       int     `json:"totalTrue"`
    62  	TotalFalse      int     `json:"totalFalse"`
    63  	PercentageTrue  float64 `json:"percentageTrue"`
    64  	PercentageFalse float64 `json:"percentageFalse"`
    65  }
    66  
    67  type Reference struct {
    68  	PointingTo []string `json:"pointingTo"`
    69  }