search

package
v5.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Inf = math.Inf(1)
View Source
var NegInf = math.Inf(-1)

Functions

func BuildPBForAggregation

func BuildPBForAggregation(a Aggregation) (*otsprotocol.Aggregation, error)

func BuildPBForAggregations

func BuildPBForAggregations(aggs []Aggregation) (*otsprotocol.Aggregations, error)

func BuildPBForGroupBy

func BuildPBForGroupBy(g GroupBy) (*otsprotocol.GroupBy, error)

func BuildPBForGroupBys

func BuildPBForGroupBys(groupBys []GroupBy) (*otsprotocol.GroupBys, error)

func BuildPBForQuery

func BuildPBForQuery(q Query) (*otsprotocol.Query, error)

func BuildPBForRanges

func BuildPBForRanges(ranges []Range) ([]*otsprotocol.Range, error)

func NewSearchQuery

func NewSearchQuery() *searchQuery

Types

type Aggregation

type Aggregation interface {
	//get agg name
	GetName() string

	//get agg type
	GetType() AggregationType

	//build body, implemented by each concrete agg
	Serialize() ([]byte, error)

	// build the whole aggregation, implemented by each concrete agg,
	// using BuildPBForAggregation() defined in agg interface
	ProtoBuffer() (*otsprotocol.Aggregation, error)
}
message Aggregation {
    optional string name = 1;
    optional AggregationType type = 2;
    optional bytes body = 3;
}

type AggregationResult

type AggregationResult interface {
	GetName() string
	GetType() AggregationType
}

type AggregationResults

type AggregationResults struct {
	// contains filtered or unexported fields
}

func ParseAggregationResultsFromPB

func ParseAggregationResultsFromPB(pbAggregationResults []*otsprotocol.AggregationResult) (*AggregationResults, error)

func (AggregationResults) Avg

func (AggregationResults) Count

func (AggregationResults) DistinctCount

func (AggregationResults) Empty

func (a AggregationResults) Empty() bool

func (*AggregationResults) GetRawResults

func (a *AggregationResults) GetRawResults() map[string]AggregationResult

func (AggregationResults) Max

func (AggregationResults) Min

func (*AggregationResults) Put

func (a *AggregationResults) Put(name string, result AggregationResult)

func (AggregationResults) Sum

type AggregationType

type AggregationType int
const (
	AggregationNoneType          AggregationType = 0
	AggregationAvgType           AggregationType = 1
	AggregationDistinctCountType AggregationType = 2
	AggregationMaxType           AggregationType = 3
	AggregationMinType           AggregationType = 4
	AggregationSumType           AggregationType = 5
	AggregationCountType         AggregationType = 6
)

func (AggregationType) Enum

func (a AggregationType) Enum() *AggregationType

func (AggregationType) String

func (a AggregationType) String() string

func (AggregationType) ToPB

type AvgAggregation

type AvgAggregation struct {
	AggName      string
	Field        string
	MissingValue interface{}
}

func NewAvgAggregation

func NewAvgAggregation(name string, fieldName string) *AvgAggregation

func (*AvgAggregation) FieldName

func (a *AvgAggregation) FieldName(fieldName string) *AvgAggregation

func (*AvgAggregation) GetName

func (a *AvgAggregation) GetName() string

func (*AvgAggregation) GetType

func (a *AvgAggregation) GetType() AggregationType

func (*AvgAggregation) Missing

func (a *AvgAggregation) Missing(missing interface{}) *AvgAggregation

func (*AvgAggregation) Name

func (a *AvgAggregation) Name(name string) *AvgAggregation

building chain

func (*AvgAggregation) ProtoBuffer

func (a *AvgAggregation) ProtoBuffer() (*otsprotocol.Aggregation, error)

func (*AvgAggregation) Serialize

func (a *AvgAggregation) Serialize() ([]byte, error)

type AvgAggregationResult

type AvgAggregationResult struct {
	Name  string
	Value float64 //+inf means missing value
}

func ParseAvgAggregationResultFromPB

func ParseAvgAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*AvgAggregationResult, error)

func (*AvgAggregationResult) GetName

func (a *AvgAggregationResult) GetName() string

func (*AvgAggregationResult) GetType

func (*AvgAggregationResult) HasValue

func (a *AvgAggregationResult) HasValue() bool

type BoolQuery

type BoolQuery struct {
	MustQueries        []Query
	MustNotQueries     []Query
	FilterQueries      []Query
	ShouldQueries      []Query
	MinimumShouldMatch *int32
}

func (*BoolQuery) ProtoBuffer

func (q *BoolQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*BoolQuery) Serialize

func (q *BoolQuery) Serialize() ([]byte, error)

func (*BoolQuery) Type

func (q *BoolQuery) Type() QueryType

type Collapse

type Collapse struct {
	FieldName string
}

func (*Collapse) ProtoBuffer

func (c *Collapse) ProtoBuffer() (*otsprotocol.Collapse, error)

type ConstScoreQuery

type ConstScoreQuery struct {
	Filter Query
}

func (*ConstScoreQuery) ProtoBuffer

func (q *ConstScoreQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*ConstScoreQuery) Serialize

func (q *ConstScoreQuery) Serialize() ([]byte, error)

func (*ConstScoreQuery) Type

func (q *ConstScoreQuery) Type() QueryType

type CountAggregation

type CountAggregation struct {
	AggName string
	Field   string
}

func NewCountAggregation

func NewCountAggregation(name string, fieldName string) *CountAggregation

func (*CountAggregation) FieldName

func (a *CountAggregation) FieldName(fieldName string) *CountAggregation

func (*CountAggregation) GetName

func (a *CountAggregation) GetName() string

func (*CountAggregation) GetType

func (a *CountAggregation) GetType() AggregationType

func (*CountAggregation) Name

func (a *CountAggregation) Name(name string) *CountAggregation

building chain

func (*CountAggregation) ProtoBuffer

func (a *CountAggregation) ProtoBuffer() (*otsprotocol.Aggregation, error)

func (*CountAggregation) Serialize

func (a *CountAggregation) Serialize() ([]byte, error)

type CountAggregationResult

type CountAggregationResult struct {
	Name  string
	Value int64
}

func ParseCountAggregationResultFromPB

func ParseCountAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*CountAggregationResult, error)

func (*CountAggregationResult) GetName

func (a *CountAggregationResult) GetName() string

func (*CountAggregationResult) GetType

type DistinctCountAggregation

type DistinctCountAggregation struct {
	AggName      string
	Field        string
	MissingValue interface{}
}

func NewDistinctCountAggregation

func NewDistinctCountAggregation(name string, fieldName string) *DistinctCountAggregation

func (*DistinctCountAggregation) FieldName

func (a *DistinctCountAggregation) FieldName(fieldName string) *DistinctCountAggregation

func (*DistinctCountAggregation) GetName

func (a *DistinctCountAggregation) GetName() string

func (*DistinctCountAggregation) GetType

func (*DistinctCountAggregation) Missing

func (a *DistinctCountAggregation) Missing(missing interface{}) *DistinctCountAggregation

func (*DistinctCountAggregation) Name

building chain

func (*DistinctCountAggregation) ProtoBuffer

func (*DistinctCountAggregation) Serialize

func (a *DistinctCountAggregation) Serialize() ([]byte, error)

type DistinctCountAggregationResult

type DistinctCountAggregationResult struct {
	Name  string
	Value int64
}

func ParseDistinctCountAggregationResultFromPB

func ParseDistinctCountAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*DistinctCountAggregationResult, error)

func (*DistinctCountAggregationResult) GetName

func (*DistinctCountAggregationResult) GetType

type ExistsQuery

type ExistsQuery struct {
	FieldName string
}

func (*ExistsQuery) ProtoBuffer

func (q *ExistsQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*ExistsQuery) Serialize

func (q *ExistsQuery) Serialize() ([]byte, error)

func (*ExistsQuery) Type

func (q *ExistsQuery) Type() QueryType

type FieldSort

type FieldSort struct {
	FieldName    string
	Order        *SortOrder
	Mode         *SortMode
	NestedFilter *NestedFilter
}

func NewFieldSort

func NewFieldSort(fieldName string, order SortOrder) *FieldSort

func (*FieldSort) ProtoBuffer

func (s *FieldSort) ProtoBuffer() (*otsprotocol.Sorter, error)

type FieldValueFactor

type FieldValueFactor struct {
	FieldName string
}

func (*FieldValueFactor) ProtoBuffer

func (f *FieldValueFactor) ProtoBuffer() (*otsprotocol.FieldValueFactor, error)

type FunctionScoreQuery

type FunctionScoreQuery struct {
	Query            Query
	FieldValueFactor *FieldValueFactor
}

func (*FunctionScoreQuery) ProtoBuffer

func (q *FunctionScoreQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*FunctionScoreQuery) Serialize

func (q *FunctionScoreQuery) Serialize() ([]byte, error)

func (*FunctionScoreQuery) Type

func (q *FunctionScoreQuery) Type() QueryType

type GeoBoundingBoxQuery

type GeoBoundingBoxQuery struct {
	FieldName   string
	TopLeft     string
	BottomRight string
}

func (*GeoBoundingBoxQuery) ProtoBuffer

func (q *GeoBoundingBoxQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*GeoBoundingBoxQuery) Serialize

func (q *GeoBoundingBoxQuery) Serialize() ([]byte, error)

func (*GeoBoundingBoxQuery) Type

func (q *GeoBoundingBoxQuery) Type() QueryType

type GeoDistanceQuery

type GeoDistanceQuery struct {
	FieldName       string
	CenterPoint     string
	DistanceInMeter float64
}

func (*GeoDistanceQuery) ProtoBuffer

func (q *GeoDistanceQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*GeoDistanceQuery) Serialize

func (q *GeoDistanceQuery) Serialize() ([]byte, error)

func (*GeoDistanceQuery) Type

func (q *GeoDistanceQuery) Type() QueryType

type GeoDistanceSort

type GeoDistanceSort struct {
	FieldName       string
	Points          []string
	Order           *SortOrder
	Mode            *SortMode
	GeoDistanceType *GeoDistanceType
	NestedFilter    *NestedFilter
}

func (*GeoDistanceSort) ProtoBuffer

func (s *GeoDistanceSort) ProtoBuffer() (*otsprotocol.Sorter, error)

type GeoDistanceType

type GeoDistanceType int8
const (
	GeoDistanceType_ARC   GeoDistanceType = 0
	GeoDistanceType_PLANE GeoDistanceType = 0
)

func (*GeoDistanceType) ProtoBuffer

func (t *GeoDistanceType) ProtoBuffer() (*otsprotocol.GeoDistanceType, error)

type GeoPoint

type GeoPoint struct {
	Lat float64 //[-90, 90]
	Lon float64 //[-180, 180]
}

type GeoPolygonQuery

type GeoPolygonQuery struct {
	FieldName string
	Points    []string
}

func (*GeoPolygonQuery) ProtoBuffer

func (q *GeoPolygonQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*GeoPolygonQuery) Serialize

func (q *GeoPolygonQuery) Serialize() ([]byte, error)

func (*GeoPolygonQuery) Type

func (q *GeoPolygonQuery) Type() QueryType

type GroupBy

type GroupBy interface {
	//get group by name
	GetName() string

	//get group by type
	GetType() GroupByType

	//build body, implemented by each concrete agg
	Serialize() ([]byte, error)

	// build the whole aggregation, implemented by each concrete agg,
	// using BuildPBForAggregation() defined in agg interface
	ProtoBuffer() (*otsprotocol.GroupBy, error)
}
	message GroupBy {
    	optional string name = 1;
    	optional GroupByType type = 2;
    	optional bytes body = 3;
	}

type GroupByField

type GroupByField struct {
	AggName string

	Field   string
	Sz      *int32
	Sorters []GroupBySorter

	SubAggList     []Aggregation
	SubGroupByList []GroupBy
}

func NewGroupByField

func NewGroupByField(name string, fieldName string) *GroupByField

func (*GroupByField) FieldName

func (g *GroupByField) FieldName(fieldName string) *GroupByField

func (*GroupByField) GetName

func (g *GroupByField) GetName() string

func (*GroupByField) GetType

func (g *GroupByField) GetType() GroupByType

func (*GroupByField) GroupBySorters

func (g *GroupByField) GroupBySorters(sorters []GroupBySorter) *GroupByField

func (*GroupByField) Name

func (g *GroupByField) Name(name string) *GroupByField

func (*GroupByField) ProtoBuffer

func (g *GroupByField) ProtoBuffer() (*otsprotocol.GroupBy, error)

func (*GroupByField) Serialize

func (g *GroupByField) Serialize() ([]byte, error)

func (*GroupByField) Size

func (g *GroupByField) Size(size int32) *GroupByField

func (*GroupByField) SubAggregation

func (g *GroupByField) SubAggregation(subAggregation Aggregation) *GroupByField

func (*GroupByField) SubAggregations

func (g *GroupByField) SubAggregations(subAggregations ...Aggregation) *GroupByField

func (*GroupByField) SubGroupBy

func (g *GroupByField) SubGroupBy(subGroupBy GroupBy) *GroupByField

func (*GroupByField) SubGroupBys

func (g *GroupByField) SubGroupBys(subGroupBys ...GroupBy) *GroupByField

type GroupByFieldResult

type GroupByFieldResult struct {
	Name  string
	Items []GroupByFieldResultItem
}

func ParseGroupByFieldResultFromPB

func ParseGroupByFieldResultFromPB(pbGroupByResult *otsprotocol.GroupByResult) (*GroupByFieldResult, error)

func (*GroupByFieldResult) GetName

func (g *GroupByFieldResult) GetName() string

func (*GroupByFieldResult) GetType

func (g *GroupByFieldResult) GetType() GroupByType

type GroupByFieldResultItem

type GroupByFieldResultItem struct {
	Key             string
	RowCount        int64
	SubAggregations AggregationResults
	SubGroupBys     GroupByResults
}

type GroupByFilter

type GroupByFilter struct {
	AggName string

	Queries []Query

	SubAggList     []Aggregation
	SubGroupByList []GroupBy
}

func NewGroupByFilter

func NewGroupByFilter(name string) *GroupByFilter

func (*GroupByFilter) GetName

func (g *GroupByFilter) GetName() string

func (*GroupByFilter) GetType

func (g *GroupByFilter) GetType() GroupByType

func (*GroupByFilter) Name

func (g *GroupByFilter) Name(name string) *GroupByFilter

func (*GroupByFilter) ProtoBuffer

func (g *GroupByFilter) ProtoBuffer() (*otsprotocol.GroupBy, error)

func (*GroupByFilter) Query

func (g *GroupByFilter) Query(query Query) *GroupByFilter

func (*GroupByFilter) Serialize

func (g *GroupByFilter) Serialize() ([]byte, error)

func (*GroupByFilter) SubAggregation

func (g *GroupByFilter) SubAggregation(subAggregation Aggregation) *GroupByFilter

func (*GroupByFilter) SubAggregations

func (g *GroupByFilter) SubAggregations(subAggregations ...Aggregation) *GroupByFilter

func (*GroupByFilter) SubGroupBy

func (g *GroupByFilter) SubGroupBy(subGroupBy GroupBy) *GroupByFilter

func (*GroupByFilter) SubGroupBys

func (g *GroupByFilter) SubGroupBys(subGroupBys ...GroupBy) *GroupByFilter

type GroupByFilterResult

type GroupByFilterResult struct {
	Name  string
	Items []GroupByFilterResultItem
}

func ParseGroupByFilterResultFromPB

func ParseGroupByFilterResultFromPB(pbGroupByResult *otsprotocol.GroupByResult) (*GroupByFilterResult, error)

func (*GroupByFilterResult) GetName

func (g *GroupByFilterResult) GetName() string

func (*GroupByFilterResult) GetType

func (g *GroupByFilterResult) GetType() GroupByType

type GroupByFilterResultItem

type GroupByFilterResultItem struct {
	RowCount        int64
	SubAggregations AggregationResults
	SubGroupBys     GroupByResults
}

type GroupByGeoDistance

type GroupByGeoDistance struct {
	AggName string

	Field     string
	Origin    GeoPoint
	RangeList []Range

	SubAggList     []Aggregation
	SubGroupByList []GroupBy
}

func NewGroupByGeoDistance

func NewGroupByGeoDistance(name string, fieldName string, origin GeoPoint) *GroupByGeoDistance

func (*GroupByGeoDistance) CenterPoint

func (g *GroupByGeoDistance) CenterPoint(latitude float64, longitude float64) *GroupByGeoDistance

func (*GroupByGeoDistance) FieldName

func (g *GroupByGeoDistance) FieldName(fieldName string) *GroupByGeoDistance

func (*GroupByGeoDistance) GetName

func (g *GroupByGeoDistance) GetName() string

func (*GroupByGeoDistance) GetType

func (g *GroupByGeoDistance) GetType() GroupByType

func (*GroupByGeoDistance) Name

func (*GroupByGeoDistance) ProtoBuffer

func (g *GroupByGeoDistance) ProtoBuffer() (*otsprotocol.GroupBy, error)

func (*GroupByGeoDistance) Range

func (g *GroupByGeoDistance) Range(fromInclusive float64, toExclusive float64) *GroupByGeoDistance

append a Range[from, to)

func (*GroupByGeoDistance) Serialize

func (g *GroupByGeoDistance) Serialize() ([]byte, error)

func (*GroupByGeoDistance) SubAggregation

func (g *GroupByGeoDistance) SubAggregation(subAggregation Aggregation) *GroupByGeoDistance

func (*GroupByGeoDistance) SubAggregations

func (g *GroupByGeoDistance) SubAggregations(subAggregations ...Aggregation) *GroupByGeoDistance

func (*GroupByGeoDistance) SubGroupBy

func (g *GroupByGeoDistance) SubGroupBy(subGroupBy GroupBy) *GroupByGeoDistance

func (*GroupByGeoDistance) SubGroupBys

func (g *GroupByGeoDistance) SubGroupBys(subGroupBys ...GroupBy) *GroupByGeoDistance

type GroupByGeoDistanceResult

type GroupByGeoDistanceResult struct {
	Name  string
	Items []GroupByGeoDistanceResultItem
}

func ParseGroupByGeoDistanceResultFromPB

func ParseGroupByGeoDistanceResultFromPB(pbGroupByResult *otsprotocol.GroupByResult) (*GroupByGeoDistanceResult, error)

func (*GroupByGeoDistanceResult) GetName

func (g *GroupByGeoDistanceResult) GetName() string

func (*GroupByGeoDistanceResult) GetType

type GroupByGeoDistanceResultItem

type GroupByGeoDistanceResultItem struct {
	RowCount int64
	From     float64
	To       float64

	SubAggregations AggregationResults
	SubGroupBys     GroupByResults
}

type GroupByRange

type GroupByRange struct {
	AggName string

	Field     string
	RangeList []Range

	SubAggList     []Aggregation
	SubGroupByList []GroupBy
}

func NewGroupByRange

func NewGroupByRange(name string, fieldName string) *GroupByRange

func (*GroupByRange) FieldName

func (g *GroupByRange) FieldName(fieldName string) *GroupByRange

func (*GroupByRange) GetName

func (g *GroupByRange) GetName() string

func (*GroupByRange) GetType

func (g *GroupByRange) GetType() GroupByType

func (*GroupByRange) Name

func (g *GroupByRange) Name(name string) *GroupByRange

func (*GroupByRange) ProtoBuffer

func (g *GroupByRange) ProtoBuffer() (*otsprotocol.GroupBy, error)

func (*GroupByRange) Range

func (g *GroupByRange) Range(fromInclusive float64, toExclusive float64) *GroupByRange

append a Range[from, to)

func (*GroupByRange) Serialize

func (g *GroupByRange) Serialize() ([]byte, error)

func (*GroupByRange) SubAggregation

func (g *GroupByRange) SubAggregation(subAggregation Aggregation) *GroupByRange

func (*GroupByRange) SubAggregations

func (g *GroupByRange) SubAggregations(subAggregations ...Aggregation) *GroupByRange

func (*GroupByRange) SubGroupBy

func (g *GroupByRange) SubGroupBy(subGroupBy GroupBy) *GroupByRange

func (*GroupByRange) SubGroupBys

func (g *GroupByRange) SubGroupBys(subGroupBys ...GroupBy) *GroupByRange

type GroupByRangeResult

type GroupByRangeResult struct {
	Name  string
	Items []GroupByRangeResultItem
}

func ParseGroupByRangeResultFromPB

func ParseGroupByRangeResultFromPB(pbGroupByResult *otsprotocol.GroupByResult) (*GroupByRangeResult, error)

func (*GroupByRangeResult) GetName

func (g *GroupByRangeResult) GetName() string

func (*GroupByRangeResult) GetType

func (g *GroupByRangeResult) GetType() GroupByType

type GroupByRangeResultItem

type GroupByRangeResultItem struct {
	RowCount int64
	From     float64
	To       float64

	SubAggregations AggregationResults
	SubGroupBys     GroupByResults
}

type GroupByResult

type GroupByResult interface {
	GetName() string
	GetType() GroupByType
}

type GroupByResults

type GroupByResults struct {
	// contains filtered or unexported fields
}

func ParseGroupByResultsFromPB

func ParseGroupByResultsFromPB(pbGroupByResults []*otsprotocol.GroupByResult) (*GroupByResults, error)

func (GroupByResults) Empty

func (g GroupByResults) Empty() bool

func (*GroupByResults) GetRawResults

func (g *GroupByResults) GetRawResults() map[string]GroupByResult

func (GroupByResults) GroupByField

func (g GroupByResults) GroupByField(name string) (*GroupByFieldResult, error)

func (GroupByResults) GroupByFilter

func (g GroupByResults) GroupByFilter(name string) (*GroupByFilterResult, error)

func (GroupByResults) GroupByGeoDistance

func (g GroupByResults) GroupByGeoDistance(name string) (*GroupByGeoDistanceResult, error)

func (GroupByResults) GroupByRange

func (g GroupByResults) GroupByRange(name string) (*GroupByRangeResult, error)

func (*GroupByResults) Put

func (g *GroupByResults) Put(name string, result GroupByResult)

type GroupBySort

type GroupBySort struct {
	Sorters []GroupBySorter
}

func (*GroupBySort) ProtoBuffer

func (s *GroupBySort) ProtoBuffer() (*otsprotocol.GroupBySort, error)

type GroupBySorter

type GroupBySorter interface {
	//should be implemented by each 'group by sorter'
	ProtoBuffer() (*otsprotocol.GroupBySorter, error)
}

interface of each child 'group by sorter'

type GroupByType

type GroupByType int
const (
	GroupByNoneType        GroupByType = 0
	GroupByFieldType       GroupByType = 1
	GroupByRangeType       GroupByType = 2
	GroupByFilterType      GroupByType = 3
	GroupByGeoDistanceType GroupByType = 4
)

func (GroupByType) Enum

func (g GroupByType) Enum() *GroupByType

func (GroupByType) String

func (a GroupByType) String() string

func (GroupByType) ToPB

type GroupKeyGroupBySort

type GroupKeyGroupBySort struct {
	Order *SortOrder
}

func (*GroupKeyGroupBySort) ProtoBuffer

func (s *GroupKeyGroupBySort) ProtoBuffer() (*otsprotocol.GroupBySorter, error)

type MatchAllQuery

type MatchAllQuery struct {
}

func (*MatchAllQuery) ProtoBuffer

func (q *MatchAllQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*MatchAllQuery) Serialize

func (q *MatchAllQuery) Serialize() ([]byte, error)

func (*MatchAllQuery) Type

func (q *MatchAllQuery) Type() QueryType

type MatchPhraseQuery

type MatchPhraseQuery struct {
	FieldName string
	Text      string
}

func (*MatchPhraseQuery) ProtoBuffer

func (q *MatchPhraseQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*MatchPhraseQuery) Serialize

func (q *MatchPhraseQuery) Serialize() ([]byte, error)

func (*MatchPhraseQuery) Type

func (q *MatchPhraseQuery) Type() QueryType

type MatchQuery

type MatchQuery struct {
	FieldName          string
	Text               string
	MinimumShouldMatch *int32
	Operator           *QueryOperator
}

func (*MatchQuery) ProtoBuffer

func (q *MatchQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*MatchQuery) Serialize

func (q *MatchQuery) Serialize() ([]byte, error)

func (*MatchQuery) Type

func (q *MatchQuery) Type() QueryType

type MaxAggregation

type MaxAggregation struct {
	AggName      string
	Field        string
	MissingValue interface{}
}

func NewMaxAggregation

func NewMaxAggregation(name string, fieldName string) *MaxAggregation

func (*MaxAggregation) FieldName

func (a *MaxAggregation) FieldName(fieldName string) *MaxAggregation

func (*MaxAggregation) GetName

func (a *MaxAggregation) GetName() string

func (*MaxAggregation) GetType

func (a *MaxAggregation) GetType() AggregationType

func (*MaxAggregation) Missing

func (a *MaxAggregation) Missing(missing interface{}) *MaxAggregation

func (*MaxAggregation) Name

func (a *MaxAggregation) Name(name string) *MaxAggregation

building chain

func (*MaxAggregation) ProtoBuffer

func (a *MaxAggregation) ProtoBuffer() (*otsprotocol.Aggregation, error)

func (*MaxAggregation) Serialize

func (a *MaxAggregation) Serialize() ([]byte, error)

type MaxAggregationResult

type MaxAggregationResult struct {
	Name  string
	Value float64 //-inf means missing value
}

func ParseMaxAggregationResultFromPB

func ParseMaxAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*MaxAggregationResult, error)

func (*MaxAggregationResult) GetName

func (a *MaxAggregationResult) GetName() string

func (*MaxAggregationResult) GetType

func (*MaxAggregationResult) HasValue

func (a *MaxAggregationResult) HasValue() bool

type MinAggregation

type MinAggregation struct {
	AggName      string
	Field        string
	MissingValue interface{}
}

func NewMinAggregation

func NewMinAggregation(name string, fieldName string) *MinAggregation

func (*MinAggregation) FieldName

func (a *MinAggregation) FieldName(fieldName string) *MinAggregation

func (*MinAggregation) GetName

func (a *MinAggregation) GetName() string

func (*MinAggregation) GetType

func (a *MinAggregation) GetType() AggregationType

func (*MinAggregation) Missing

func (a *MinAggregation) Missing(missing interface{}) *MinAggregation

func (*MinAggregation) Name

func (a *MinAggregation) Name(name string) *MinAggregation

building chain

func (*MinAggregation) ProtoBuffer

func (a *MinAggregation) ProtoBuffer() (*otsprotocol.Aggregation, error)

func (*MinAggregation) Serialize

func (a *MinAggregation) Serialize() ([]byte, error)

type MinAggregationResult

type MinAggregationResult struct {
	Name  string
	Value float64 //+inf means missing value
}

func ParseMinAggregationResultFromPB

func ParseMinAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*MinAggregationResult, error)

func (*MinAggregationResult) GetName

func (a *MinAggregationResult) GetName() string

func (*MinAggregationResult) GetType

func (*MinAggregationResult) HasValue

func (a *MinAggregationResult) HasValue() bool

type NestedFilter

type NestedFilter struct {
	Path   string
	Filter Query
}

func (*NestedFilter) ProtoBuffer

func (f *NestedFilter) ProtoBuffer() (*otsprotocol.NestedFilter, error)

type NestedQuery

type NestedQuery struct {
	Path      string
	Query     Query
	ScoreMode ScoreModeType
}

func (*NestedQuery) ProtoBuffer

func (q *NestedQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*NestedQuery) Serialize

func (q *NestedQuery) Serialize() ([]byte, error)

func (*NestedQuery) Type

func (q *NestedQuery) Type() QueryType

type PrefixQuery

type PrefixQuery struct {
	FieldName string
	Prefix    string
}

func (*PrefixQuery) ProtoBuffer

func (q *PrefixQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*PrefixQuery) Serialize

func (q *PrefixQuery) Serialize() ([]byte, error)

func (*PrefixQuery) Type

func (q *PrefixQuery) Type() QueryType

type PrimaryKeySort

type PrimaryKeySort struct {
	Order *SortOrder
}

func NewPrimaryKeySort

func NewPrimaryKeySort() *PrimaryKeySort

func (*PrimaryKeySort) ProtoBuffer

func (s *PrimaryKeySort) ProtoBuffer() (*otsprotocol.Sorter, error)

type Query

type Query interface {
	Type() QueryType
	Serialize() ([]byte, error)
	ProtoBuffer() (*otsprotocol.Query, error)
}

type QueryOperator

type QueryOperator int8
const (
	QueryOperator_OR  QueryOperator = 0
	QueryOperator_AND QueryOperator = 1
)

func (QueryOperator) Enum

func (x QueryOperator) Enum() *QueryOperator

func (*QueryOperator) ProtoBuffer

func (o *QueryOperator) ProtoBuffer() (*otsprotocol.QueryOperator, error)

type QueryType

type QueryType int
const (
	QueryType_None                QueryType = 0
	QueryType_MatchQuery          QueryType = 1
	QueryType_MatchPhraseQuery    QueryType = 2
	QueryType_TermQuery           QueryType = 3
	QueryType_RangeQuery          QueryType = 4
	QueryType_PrefixQuery         QueryType = 5
	QueryType_BoolQuery           QueryType = 6
	QueryType_ConstScoreQuery     QueryType = 7
	QueryType_FunctionScoreQuery  QueryType = 8
	QueryType_NestedQuery         QueryType = 9
	QueryType_WildcardQuery       QueryType = 10
	QueryType_MatchAllQuery       QueryType = 11
	QueryType_GeoBoundingBoxQuery QueryType = 12
	QueryType_GeoDistanceQuery    QueryType = 13
	QueryType_GeoPolygonQuery     QueryType = 14
	QueryType_TermsQuery          QueryType = 15
	QueryType_ExistsQuery         QueryType = 16
)

func (QueryType) Enum

func (q QueryType) Enum() *QueryType

func (QueryType) ToPB

func (q QueryType) ToPB() *otsprotocol.QueryType

type Range

type Range struct {
	// contains filtered or unexported fields
}

type RangeQuery

type RangeQuery struct {
	FieldName    string
	From         interface{}
	To           interface{}
	IncludeLower bool
	IncludeUpper bool
}

func (*RangeQuery) GT

func (q *RangeQuery) GT(value interface{})

func (*RangeQuery) GTE

func (q *RangeQuery) GTE(value interface{})

func (*RangeQuery) LT

func (q *RangeQuery) LT(value interface{})

func (*RangeQuery) LTE

func (q *RangeQuery) LTE(value interface{})

func (*RangeQuery) ProtoBuffer

func (q *RangeQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*RangeQuery) Serialize

func (q *RangeQuery) Serialize() ([]byte, error)

func (*RangeQuery) Type

func (q *RangeQuery) Type() QueryType

type RowCountGroupBySort

type RowCountGroupBySort struct {
	Order *SortOrder
}

func (*RowCountGroupBySort) ProtoBuffer

func (s *RowCountGroupBySort) ProtoBuffer() (*otsprotocol.GroupBySorter, error)

type ScoreModeType

type ScoreModeType int
const (
	ScoreMode_None  ScoreModeType = 1
	ScoreMode_Avg   ScoreModeType = 2
	ScoreMode_Max   ScoreModeType = 3
	ScoreMode_Total ScoreModeType = 4
	ScoreMode_Min   ScoreModeType = 5
)

type ScoreSort

type ScoreSort struct {
	Order *SortOrder
}

func NewScoreSort

func NewScoreSort() *ScoreSort

func (*ScoreSort) ProtoBuffer

func (s *ScoreSort) ProtoBuffer() (*otsprotocol.Sorter, error)

type SearchQuery

type SearchQuery interface {
	Serialize() ([]byte, error)
}

type Sort

type Sort struct {
	Sorters []Sorter
}

func (*Sort) ProtoBuffer

func (s *Sort) ProtoBuffer() (*otsprotocol.Sort, error)

type SortMode

type SortMode int8
const (
	SortMode_Min SortMode = 0
	SortMode_Max SortMode = 1
	SortMode_Avg SortMode = 2
)

func (SortMode) Enum

func (x SortMode) Enum() *SortMode

func (*SortMode) ProtoBuffer

func (m *SortMode) ProtoBuffer() (*otsprotocol.SortMode, error)

type SortOrder

type SortOrder int8
const (
	SortOrder_ASC  SortOrder = 0
	SortOrder_DESC SortOrder = 1
)

func ParseSortOrder

func ParseSortOrder(order *otsprotocol.SortOrder) *SortOrder

func (SortOrder) Enum

func (x SortOrder) Enum() *SortOrder

func (*SortOrder) ProtoBuffer

func (o *SortOrder) ProtoBuffer() (*otsprotocol.SortOrder, error)

type Sorter

type Sorter interface {
	ProtoBuffer() (*otsprotocol.Sorter, error)
}

type SubAggGroupBySort

type SubAggGroupBySort struct {
	Order      *SortOrder
	SubAggName string
}

func (*SubAggGroupBySort) ProtoBuffer

func (s *SubAggGroupBySort) ProtoBuffer() (*otsprotocol.GroupBySorter, error)

type SumAggregation

type SumAggregation struct {
	AggName      string
	Field        string
	MissingValue interface{}
}

func NewSumAggregation

func NewSumAggregation(name string, fieldName string) *SumAggregation

func (*SumAggregation) FieldName

func (a *SumAggregation) FieldName(fieldName string) *SumAggregation

func (*SumAggregation) GetName

func (a *SumAggregation) GetName() string

func (*SumAggregation) GetType

func (a *SumAggregation) GetType() AggregationType

func (*SumAggregation) Missing

func (a *SumAggregation) Missing(missing interface{}) *SumAggregation

func (*SumAggregation) Name

func (a *SumAggregation) Name(name string) *SumAggregation

building chain

func (*SumAggregation) ProtoBuffer

func (a *SumAggregation) ProtoBuffer() (*otsprotocol.Aggregation, error)

func (*SumAggregation) Serialize

func (a *SumAggregation) Serialize() ([]byte, error)

type SumAggregationResult

type SumAggregationResult struct {
	Name  string
	Value float64 //0 means either field missing or 'sum is actually 0'
}

func ParseSumAggregationResultFromPB

func ParseSumAggregationResultFromPB(pbAggResult *otsprotocol.AggregationResult) (*SumAggregationResult, error)

func (*SumAggregationResult) GetName

func (a *SumAggregationResult) GetName() string

func (*SumAggregationResult) GetType

type TermQuery

type TermQuery struct {
	FieldName string
	Term      interface{}
}

func (*TermQuery) ProtoBuffer

func (q *TermQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*TermQuery) Serialize

func (q *TermQuery) Serialize() ([]byte, error)

func (*TermQuery) Type

func (q *TermQuery) Type() QueryType

type TermsQuery

type TermsQuery struct {
	FieldName string
	Terms     []interface{}
}

func (*TermsQuery) ProtoBuffer

func (q *TermsQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*TermsQuery) Serialize

func (q *TermsQuery) Serialize() ([]byte, error)

func (*TermsQuery) Type

func (q *TermsQuery) Type() QueryType

type VariantType

type VariantType byte
const (
	// variant type
	VT_INTEGER VariantType = 0x0
	VT_DOUBLE  VariantType = 0x1
	VT_BOOLEAN VariantType = 0x2
	VT_STRING  VariantType = 0x3
)

type VariantValue

type VariantValue []byte

func ToVariantValue

func ToVariantValue(value interface{}) (VariantValue, error)

func VTBoolean

func VTBoolean(b bool) VariantValue

func VTDouble

func VTDouble(v float64) VariantValue

func VTInteger

func VTInteger(v int64) VariantValue

func VTString

func VTString(v string) VariantValue

func (*VariantValue) GetType

func (v *VariantValue) GetType() VariantType

type WildcardQuery

type WildcardQuery struct {
	FieldName string
	Value     string
}

func (*WildcardQuery) ProtoBuffer

func (q *WildcardQuery) ProtoBuffer() (*otsprotocol.Query, error)

func (*WildcardQuery) Serialize

func (q *WildcardQuery) Serialize() ([]byte, error)

func (*WildcardQuery) Type

func (q *WildcardQuery) Type() QueryType

Jump to

Keyboard shortcuts

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