Documentation ¶
Overview ¶
Copyright 2019 The Vearch Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The Vearch Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The Vearch Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The Vearch Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func SelectKMin(s []float64, k int) []float64
- func SelectKthMin(s []float64, k int) float64
- func SelectMid(s []float64) float64
- type DateSortValue
- type FloatSortValue
- type GeoDistanceSortValue
- type InfinitySortValue
- type IntSortValue
- type Sort
- type SortDoc
- type SortField
- func (s *SortField) Compare(i, j SortValue) int
- func (s *SortField) GetSortOrder() bool
- func (s *SortField) SetMissing(missingMode SortFieldMissing, missingValue interface{})
- func (s *SortField) SetMode(mode SortFieldMode)
- func (s *SortField) SetOrder(desc bool)
- func (s *SortField) SortField() string
- type SortFieldMissing
- type SortFieldMode
- type SortOrder
- type SortScore
- type SortValue
- type SortValues
- type StringSortValue
- type ValueType
Constants ¶
This section is empty.
Variables ¶
var NegativeInfinity *big.Int
var PositiveInfinity *big.Int
Functions ¶
func SelectKthMin ¶
Types ¶
type DateSortValue ¶
func (*DateSortValue) Compare ¶
func (sv *DateSortValue) Compare(other SortValue) int
func (*DateSortValue) Value ¶
func (sv *DateSortValue) Value() interface{}
type FloatSortValue ¶
func (*FloatSortValue) Compare ¶
func (sv *FloatSortValue) Compare(other SortValue) int
func (*FloatSortValue) Value ¶
func (sv *FloatSortValue) Value() interface{}
type GeoDistanceSortValue ¶
func (*GeoDistanceSortValue) Compare ¶
func (sv *GeoDistanceSortValue) Compare(other SortValue) int
func (*GeoDistanceSortValue) Value ¶
func (sv *GeoDistanceSortValue) Value() interface{}
type InfinitySortValue ¶
func (*InfinitySortValue) Compare ¶
func (sv *InfinitySortValue) Compare(other SortValue) int
func (*InfinitySortValue) Value ¶
func (sv *InfinitySortValue) Value() interface{}
type IntSortValue ¶
func (*IntSortValue) Compare ¶
func (sv *IntSortValue) Compare(other SortValue) int
func (*IntSortValue) Value ¶
func (sv *IntSortValue) Value() interface{}
type SortField ¶
type SortField struct { Field string Desc bool Mode SortFieldMode Missing SortFieldMissing MissingValue interface{} // contains filtered or unexported fields }
func NewSortField ¶
func (*SortField) GetSortOrder ¶
func (*SortField) SetMissing ¶
func (s *SortField) SetMissing(missingMode SortFieldMissing, missingValue interface{})
func (*SortField) SetMode ¶
func (s *SortField) SetMode(mode SortFieldMode)
type SortFieldMissing ¶
type SortFieldMissing int
SortFieldMissing controls where documents missing a field value should be sorted
const ( // SortFieldMissingLast sorts documents missing a field at the end SortFieldMissingLast SortFieldMissing = iota // SortFieldMissingFirst sorts documents missing a field at the beginning SortFieldMissingFirst // SortFieldMissingCustom sorts documents missing a field with a custom value SortFieldMissingCustom )
type SortFieldMode ¶
type SortFieldMode int
SortFieldMode describes the behavior if the field has multiple values
const ( // SortFieldDefault uses the first (or only) value, this is the default zero-value SortFieldDefault SortFieldMode = iota // FIXME name is confusing // SortFieldMin uses the minimum value SortFieldMin // SortFieldMax uses the maximum value SortFieldMax // Use the sum of all values as sort value. Only applicable for number based array fields. SortFieldSum // Use the average of all values as sort value. Only applicable for number based array fields. SortFieldAvg // Use the median of all values as sort value. Only applicable for number based array fields. SortFieldMedian )
type SortOrder ¶
type SortOrder []Sort
func (SortOrder) Compare ¶
func (so SortOrder) Compare(a, b SortValues) int
Compare will compare two document matches using the specified sort order if both are numbers, we avoid converting back to term
type SortValues ¶
type SortValues []SortValue
func (SortValues) Len ¶
func (svs SortValues) Len() int
func (SortValues) Less ¶
func (svs SortValues) Less(i, j int) bool
func (SortValues) Reset ¶
func (vs SortValues) Reset() SortValues
func (SortValues) Swap ¶
func (svs SortValues) Swap(i, j int)
Swap swaps the elements with indexes i and j.
func (SortValues) Values ¶
func (vs SortValues) Values() []interface{}
type StringSortValue ¶
func (*StringSortValue) Compare ¶
func (sv *StringSortValue) Compare(other SortValue) int
func (*StringSortValue) Type ¶
func (sv *StringSortValue) Type() ValueType
func (*StringSortValue) Value ¶
func (sv *StringSortValue) Value() interface{}