common

package
v0.0.0-...-9c67b44 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const HighlightPostTag = "<__POST_HL_TAG__>"
View Source
const HighlightPreTag = "<__PRE_HL_TAG__>"

Variables

This section is empty.

Functions

func CreateFilterQuery

func CreateFilterQuery(simpleField string, value interface{}) []elastic.Query

func CreateSortBy

func CreateSortBy(sortField string, sortOrder string) elastic.Sorter

func CreateSortByMultiple

func CreateSortByMultiple(sortParameters []SortParameter) []elastic.Sorter

func EscapeQueryStringQuery

func EscapeQueryStringQuery(query string) string

escape reserved characters, but preserve any leading or trailing wildcards

Types

type Aggregation

type Aggregation struct {
	Buckets                 []Bucket `json:"buckets,omitempty"`
	DocCountErrorUpperBound int      `json:"doc_count_error_upper_bound"`
	SumOtherDocCount        int      `json:"sum_other_doc_count"`
}

func ParseAggregation

func ParseAggregation(aggregations elastic.Aggregations, name string) (Aggregation, error)

type Bucket

type Bucket struct {
	// For boolean values, ES will return 0/1 as key, so we need to handle both
	// integers and strings as bucket key.
	Key         intOrString `json:"key,omitempty"`
	KeyAsString string      `json:"key_as_string,omitempty"`
	Count       int         `json:"doc_count,omitempty"`
}

type HighlightPart

type HighlightPart struct {
	Highlighted bool   `json:"highlighted"`
	Text        string `json:"text"`
}

func TransformEsHighlight

func TransformEsHighlight(esHighlight string) []HighlightPart

type SortParameter

type SortParameter struct {
	Field     string
	Ascending bool
}

func ParseSortParams

func ParseSortParams(str string) ([]SortParameter, error)

Jump to

Keyboard shortcuts

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