search

package
v0.0.0-...-eb961a3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAGE_SIZE   int = 20
	MIN_RESULTS int = 20
)
View Source
const (
	ITUNES_SEARCH_URL string = "https://itunes.apple.com/search?media=podcast&entity=podcast&limit=200&term="
)

Variables

This section is empty.

Functions

func ScheduleEpisodeIndexing

func ScheduleEpisodeIndexing()

func SchedulePodcastIndexing

func SchedulePodcastIndexing()

Types

type ElasticOperatorQuery

type ElasticOperatorQuery struct {
	Query MatchOperator `json:"query"`
}

type ElasticPrecisionQuery

type ElasticPrecisionQuery struct {
	Query MatchPrecision `json:"query"`
}

type ElasticResponse

type ElasticResponse struct {
	Took    int   `json:"took"`
	TimeOut bool  `json:"time_out"`
	Shards  Shard `json:"_shards"`
	Hits    HitsInfo
}

type FieldOperator

type FieldOperator struct {
	Field QueryOperator `json:"_all"`
}

type FieldPrecision

type FieldPrecision struct {
	Field QueryPrecision `json:"_all"`
}

type HitDetail

type HitDetail struct {
	Index string  `json:"_index"`
	Kind  string  `json:"_type"`
	Id    string  `json:"_id"`
	Score float32 `json:"_score"`
}

type HitsInfo

type HitsInfo struct {
	Total    int         `json:"total"`
	MaxScore float32     `json:"max_score"`
	Hits     []HitDetail `json:"hits"`
}

type MatchOperator

type MatchOperator struct {
	Match FieldOperator `json:"match"`
}

type MatchPrecision

type MatchPrecision struct {
	Match FieldPrecision `json:"match"`
}

type PodcastSearchMetadata

type PodcastSearchMetadata struct {
	Uid         string `json:"uid"`
	Title       string `json:"title"`
	Subtitle    string `json:"subtitle"`
	Description string `json:"description"`
	Language    string `json:"language"`
	OwnerName   string `json:"owner_name"`
	OwnerEmail  string `json:"owner_email"`
}

type QueryOperator

type QueryOperator struct {
	Q        string `json:"query"`
	Operator string `json:"operator"`
}

type QueryPrecision

type QueryPrecision struct {
	Q        string `json:"query"`
	Operator string `json:"minimum_should_match"`
}

type Result

type Result struct {
	Uid         string `jsonapi:"primary,result"`
	Kind        string `jsonapi:"attr,kind"` // podcast | episode
	Title       string `jsonapi:"attr,title"`
	Subtitle    string `jsonapi:"attr,subtitle"`
	Description string `jsonapi:"attr,description"`
	Url         string `jsonapi:"attr,url"`
	Feed        string `jsonapi:"attr,feed"`
	ImageUrl    string `jsonapi:"attr,image_url"`

	// metadata
	Score     int   `jsonapi:"attr,score"` // scaled to [0..100]
	Published int64 `jsonapi:"attr,published"`
}

func SearchITunes

func SearchITunes(q string) ([]*Result, error)

type ResultSorter

type ResultSorter []*Result

TODO keep this for now, we may need it for sorting of results at some point

func (ResultSorter) Len

func (r ResultSorter) Len() int

func (ResultSorter) Less

func (r ResultSorter) Less(i, j int) bool

func (ResultSorter) Swap

func (r ResultSorter) Swap(i, j int)

type SearchResult

type SearchResult struct {
	Uid        string    `jsonapi:"primary,search"`
	Count      int       `jsonapi:"attr,count"`
	SearchTerm string    `jsonapi:"attr,search_term"`
	Duration   int64     `jsonapi:"attr,duration"`
	Results    []*Result `jsonapi:"relation,results"`
}
func Search(q string, page int, limit int) *SearchResult

func SearchElastic

func SearchElastic(q string, page int, limit int) (*SearchResult, error)

type Shard

type Shard struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

Jump to

Keyboard shortcuts

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