search

package
v4.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPBForQuery

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

func NewSearchQuery

func NewSearchQuery() *searchQuery

Types

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 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 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 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 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
)

func (QueryType) Enum

func (q QueryType) Enum() *QueryType

func (QueryType) ToPB

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

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 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 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