Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultResultsPerPage = 10
Variables ¶
View Source
var ( SearchFields = []string{DefaultSearchField, "type", "text", "conv", "subject", "tags", "links", "mentions", "nick", "feed", "author", } DefaultSort = []string{"-created", "-_score", "-_id"} )
View Source
var ErrBadConfiguration = errors.New("error: both path and memory options cannot be used")
Functions ¶
func FileExists ¶
func IsValidSearchField ¶
func IsValidSearchType ¶
func IsValidSearchType(t SearchType) bool
Types ¶
type Config ¶
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type ConfigOption ¶
func WithMemory ¶
func WithMemory() ConfigOption
func WithPath ¶
func WithPath(p string) ConfigOption
func WithResultsPerPage ¶
func WithResultsPerPage(resultsPerPage int) ConfigOption
type Entry ¶
type Entry struct { Twt types.Twt Type string `json:"type"` Text string `json:"text"` Conv string `json:"conv"` Subject string `json:"subject"` Created time.Time `json:"created"` Tags []string `json:"tags"` Links []string `json:"links"` Mentions []string `json:"mentions"` Nick string `json:"nick"` Feed string `json:"feed"` Author string `json:"author"` Avatar string `json:"avatar"` }
type Indexer ¶
type Indexer interface { Index(entry Entry) error Size() int64 Search(qs string, opts ...SearchOption) (res *SearchResponse, err error) }
func NewBleveIndexer ¶
func NewBleveIndexer(opts ...ConfigOption) (Indexer, error)
type Result ¶
type SearchOption ¶
type SearchOption func(opts *SearchOptions) error
func SetField ¶
func SetField(f string) SearchOption
func SetPage ¶
func SetPage(p int) SearchOption
func SetType ¶
func SetType(t SearchType) SearchOption
func SortBy ¶
func SortBy(sort []string) SearchOption
type SearchOptions ¶
type SearchOptions struct { Type SearchType Field string Page int Sort []string }
func NewDefaultSearchOptions ¶
func NewDefaultSearchOptions() *SearchOptions
type SearchResponse ¶
type SearchType ¶
type SearchType string
const ( SearchTypeQuery SearchType = "qs" SearchTypeMatch SearchType = "match" SearchTypeTerm SearchType = "term" SearchTypeUndefined SearchType = "" DefaultSearchType = SearchTypeMatch DefaultSearchField = "_all" )
Click to show internal directories.
Click to hide internal directories.