aggregation

package
v1.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const TopOccurrencesType = "topOccurrences"

Variables

View Source
var (
	CountAggregator = Aggregator{Type: "count"}
	TypeAggregator  = Aggregator{Type: "type"}
)

Aggregators used in every prop

View Source
var (
	SumAggregator     = Aggregator{Type: "sum"}
	MeanAggregator    = Aggregator{Type: "mean"}
	ModeAggregator    = Aggregator{Type: "mode"}
	MedianAggregator  = Aggregator{Type: "median"}
	MaximumAggregator = Aggregator{Type: "maximum"}
	MinimumAggregator = Aggregator{Type: "minimum"}
)

Aggregators used in numerical props

View Source
var (
	TotalTrueAggregator       = Aggregator{Type: "totalTrue"}
	PercentageTrueAggregator  = Aggregator{Type: "percentageTrue"}
	TotalFalseAggregator      = Aggregator{Type: "totalFalse"}
	PercentageFalseAggregator = Aggregator{Type: "percentageFalse"}
)

Aggregators used in boolean props

View Source
var (
	PointingToAggregator = Aggregator{Type: "pointingTo"}
)

Aggregators used in ref props

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	Type  string `json:"type"`
	Limit *int   `json:"limit"` // used on TopOccurrence Agg
}

func NewTopOccurrencesAggregator

func NewTopOccurrencesAggregator(limit *int) Aggregator

NewTopOccurrencesAggregator creates a TopOccurrencesAggregator, we cannot use a singleton for this as the desired limit can be different each time

func ParseAggregatorProp

func ParseAggregatorProp(name string) (Aggregator, error)

func (Aggregator) String

func (a Aggregator) String() string

type Boolean

type Boolean struct {
	Count           int     `json:"count"`
	TotalTrue       int     `json:"totalTrue"`
	TotalFalse      int     `json:"totalFalse"`
	PercentageTrue  float64 `json:"percentageTrue"`
	PercentageFalse float64 `json:"percentageFalse"`
}

type Group

type Group struct {
	Properties map[string]Property `json:"properties"`
	GroupedBy  *GroupedBy          `json:"groupedBy"` // optional to support ungrouped aggregations (formerly meta)
	Count      int                 `json:"count"`
}

type GroupedBy

type GroupedBy struct {
	Value interface{} `json:"value"`
	Path  []string    `json:"path"`
}

type ParamProperty

type ParamProperty struct {
	Name        schema.PropertyName `json:"name"`
	Aggregators []Aggregator        `json:"aggregators"`
}

type Params

type Params struct {
	Filters          *filters.LocalFilter       `json:"filters"`
	ClassName        schema.ClassName           `json:"className"`
	Properties       []ParamProperty            `json:"properties"`
	GroupBy          *filters.Path              `json:"groupBy"`
	IncludeMetaCount bool                       `json:"includeMetaCount"`
	Limit            *int                       `json:"limit"`
	ObjectLimit      *int                       `json:"objectLimit"`
	SearchVector     []float32                  `json:"searchVector"`
	TargetVector     string                     `json:"targetVector"`
	Certainty        float64                    `json:"certainty"`
	Tenant           string                     `json:"tenant"`
	ModuleParams     map[string]interface{}     `json:"moduleParams"`
	NearVector       *searchparams.NearVector   `json:"nearVector"`
	NearObject       *searchparams.NearObject   `json:"nearObject"`
	Hybrid           *searchparams.HybridSearch `json:"hybrid"`
}

type Property

type Property struct {
	Type                  PropertyType           `json:"type"`
	NumericalAggregations map[string]interface{} `json:"numericalAggregations"`
	TextAggregation       Text                   `json:"textAggregation"`
	BooleanAggregation    Boolean                `json:"booleanAggregation"`
	SchemaType            string                 `json:"schemaType"`
	ReferenceAggregation  Reference              `json:"referenceAggregation"`
	DateAggregations      map[string]interface{} `json:"dateAggregation"`
}

type PropertyType

type PropertyType string
const (
	PropertyTypeNumerical PropertyType = "numerical"
	PropertyTypeBoolean   PropertyType = "boolean"
	PropertyTypeText      PropertyType = "text"
	PropertyTypeDate      PropertyType = "date"
	PropertyTypeReference PropertyType = "cref"
)

type Reference

type Reference struct {
	PointingTo []string `json:"pointingTo"`
}

type Result

type Result struct {
	Groups []Group `json:"groups"`
}

type Text

type Text struct {
	Items []TextOccurrence `json:"items"`
	Count int              `json:"count"`
}

type TextOccurrence

type TextOccurrence struct {
	Value  string `json:"value"`
	Occurs int    `json:"occurs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL