filters

package
v0.0.0-...-663df1f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator is the registry of ElasticFilters

func NewAggregator

func NewAggregator(values url.Values, filters ...ElasticFilter) Aggregator

NewAggregator is the factory method of Aggregator

func (Aggregator) Filter

func (a Aggregator) Filter(query *elastic.BoolQuery) map[string]error

Filter calls all registered filters Filter methods

type CityFilter

type CityFilter struct {
	City bool `form:"city"`
}

CityFilter holds the filter behavior and the query form data

func NewCityFilter

func NewCityFilter() *CityFilter

NewCityFilter is the factory method for CityFilter

func (*CityFilter) Filter

func (f *CityFilter) Filter(values url.Values, query *elastic.BoolQuery) error

Filter adds a TermQuery filter to the BoolQuery from city boolean value in the url

type ElasticFilter

type ElasticFilter interface {
	// Filter add new conditions to the BoolQuery from url
	Filter(values url.Values, query *elastic.BoolQuery) error
}

ElasticFilter defines the Filter method which builds the ElasticSearch BoolQuery depending on url values

type FeatureCoordinatesFilter

type FeatureCoordinatesFilter struct {
	Longitude float64 `form:"longitude"`
	Latitude  float64 `form:"latitude"`
	Radius    uint64  `form:"radius"`
}

FeatureCoordinatesFilter holds the filter behavior and the query form data

func NewFeatureCoordinatesFilter

func NewFeatureCoordinatesFilter() *FeatureCoordinatesFilter

NewFeatureCoordinatesFilter is the factory method for FeatureCoordinatesFilter

func (*FeatureCoordinatesFilter) Filter

func (f *FeatureCoordinatesFilter) Filter(values url.Values, query *elastic.BoolQuery) error

Filter adds a GeoShapeQuery to the BoolQuery from coordinates in the url

type SearchFilter

type SearchFilter struct {
	Search string `form:"q"`
}

SearchFilter holds the filter behavior and the query form data

func NewSearchFilter

func NewSearchFilter() *SearchFilter

NewSearchFilter is the factory method for SearchFilter

func (*SearchFilter) Filter

func (f *SearchFilter) Filter(values url.Values, query *elastic.BoolQuery) error

Filter adds a MultiMatchQuery to the BoolQuery from search string in the url

Jump to

Keyboard shortcuts

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