Documentation ¶
Overview ¶
Package bangs provides functionality to query other websites
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bang ¶
type Bang struct { Name string `json:"name"` FavIcon string `json:"favicon"` Triggers []string `json:"triggers"` Regions map[string]string `json:"regions"` Functions []string `json:"-"` Funcs []fn `json:"-"` }
Bang holds a single !bang
type Bangs ¶
Bangs holds a map of !bangs
func (*Bangs) CreateFunctions ¶
CreateFunctions creates []Funcs from []Functions. Is a workaround since I couldn't find a way to map a function type in a config file.
type ElasticSearch ¶
ElasticSearch holds the index name and the connection
func (*ElasticSearch) DeleteIndex ¶
func (e *ElasticSearch) DeleteIndex() error
DeleteIndex will delete the existing index
func (*ElasticSearch) IndexExists ¶
func (e *ElasticSearch) IndexExists() (bool, error)
IndexExists returns true if the index exists
func (*ElasticSearch) Setup ¶
func (e *ElasticSearch) Setup(bangs []Bang) error
Setup recreates the completion index
func (*ElasticSearch) SuggestResults ¶
func (e *ElasticSearch) SuggestResults(term string, size int) (Results, error)
SuggestResults retrieves !bang suggestions from Elasticsearch
type Provider ¶
type Provider interface { ReadInConfig() error Unmarshal(interface{}, ...viper.DecoderConfigOption) error }
Provider is a configuration provider
type Results ¶
type Results struct {
Suggestions []Suggestion `json:"suggestions"`
}
Results are the results of an autocomplete query
type Simple ¶
type Simple struct {
// contains filtered or unexported fields
}
Simple is a simple autocomplete suggester
func (*Simple) DeleteIndex ¶
DeleteIndex will delete the existing index
func (*Simple) IndexExists ¶
IndexExists returns true if the index exists
type Suggester ¶
type Suggester interface { IndexExists() (bool, error) DeleteIndex() error Setup([]Bang) error SuggestResults(term string, size int) (Results, error) }
Suggester is a !bangs suggester/autocomplete
type Suggestion ¶
type Suggestion struct { Trigger string `json:"trigger"` Name string `json:"name"` FavIcon string `json:"favicon"` }
Suggestion is an individual !bang autocomplete suggestion