Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶
func InitConfig(c Config)
Types ¶
type Condition ¶
type Condition struct { Field string `mapstructure:"field"` // result field name, like title, description,... Operator string `mapstructure:"operator"` // operator, like in, containAny Expects []string `mapstructure:"expects"` // expect values }
Condition is to determine whether the search results meet some requirements.
type Data ¶
type Data struct { Engine string `json:"engine"` // Engine is search engine name, means result source. Title string `json:"title"` // Title is the search result title. Url string `json:"url"` // Url link to the third party website. Content string `json:"content"` // Content is a short description. ImgSrc string `json:"img_src"` // ImgSrc is an image Url, used for poster. Thumbnail string `json:"thumbnail"` // Thumbnail Url for some video result. // Query is the query of search. Query string `json:"-"` // contains filtered or unexported fields }
Data of search result
type InfoBox ¶
type InfoBox struct { Title string `json:"title"` Content string `json:"content"` ImgSrc string `json:"img_src"` Url string `json:"url"` UrlList []map[string]string `json:"url_list"` }
InfoBox of search query from wikipedia(temporary)
type Result ¶
type Result struct { MergedData []*Data `json:"merged_data"` // MergedData store result from different search engines. Suggestions *util.Set `json:"suggestions"` // Suggestions store suggestion from different search engines. InfoBox *InfoBox `json:"infoBox"` // InfoBox store information from wikipedia of query From string `json:"-"` // From means the engine name of the search results. PageNo int `json:"-"` // PageNo means the page number of result. PageNo = 1 means first page. }
Result of search
func CreateResult ¶
func (*Result) AppendData ¶
func (*Result) GetDataSize ¶
func (*Result) GetSortedData ¶
type Rule ¶
type Rule struct { Name string `mapstructure:"name"` Enable bool `mapstructure:"enable"` Score int `mapstructure:"score"` Conditions []Condition `mapstructure:"conditions"` }
Rule is a way that scores search results depends on conditions.
Click to show internal directories.
Click to hide internal directories.