Documentation
¶
Index ¶
- Variables
- func DocMapping() *mapping.DocumentMapping
- func GetAll(idx bleve.Index, opts *SearchOpts) (*bleve.SearchResult, error)
- func GetAllIDs(idx bleve.Index, maxID int) map[int]bool
- func GetLatestID(idx bleve.Index) int
- func Open(path string) (bleve.Index, error)
- func SearchStr(idx bleve.Index, queryStr string, opts *SearchOpts) (*bleve.SearchResult, error)
- func SetLogger(l *zap.SugaredLogger)
- type SearchOpts
- type XKCDStrip
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultSearchOpts = &SearchOpts{
Fields: allFields,
}
Functions ¶
func DocMapping ¶
func DocMapping() *mapping.DocumentMapping
DocMapping returns a bleve document mapping suitable to store this object and attaches it to a main index mapping.
func GetAll ¶
func GetAll(idx bleve.Index, opts *SearchOpts) (*bleve.SearchResult, error)
GetAll fetches all records, according to the search options
func GetAllIDs ¶
GetAllIDs will return a list of IDs of all strips that have been downloaded, up to maxID.
func GetLatestID ¶
GetLatestID returns the highest ID recorded in the database
func SearchStr ¶
func SearchStr(idx bleve.Index, queryStr string, opts *SearchOpts) (*bleve.SearchResult, error)
SearchStr will perform a string query on the datastore
Types ¶
type SearchOpts ¶
func (SearchOpts) Apply ¶
func (s SearchOpts) Apply(request *bleve.SearchRequest)
type XKCDStrip ¶
type XKCDStrip struct {
ID int `json:"id"`
Title string `json:"title"`
Transcript string `json:"transcript"`
Date string `json:"date"`
Img string `json:"img"`
Comment string `json:"comment"`
}
XKCDStrip is the data structure we save to the index
func NewStrip ¶
NewStrip transforms what we got from the wire into a document we can index in bleve.
func NewStripFromDb ¶
func NewStripFromDb(result *search.DocumentMatch) *XKCDStrip
NewStripFromDb returns an xkcd strip from data recovered from the database.
Click to show internal directories.
Click to hide internal directories.