Documentation ¶
Index ¶
- Constants
- func NewAllEnabled() []engines.Name
- func NewGeneral() []engines.Name
- func NewImage() []engines.Name
- func NewScience() []engines.Name
- func NewSettings() map[engines.Name]Settings
- type Badger
- type Cache
- type Category
- type CategoryEngineRanking
- type CategoryRanking
- type CategoryTimings
- type Config
- type ImageProxy
- type ImageProxyTimeouts
- type ReaderCache
- type ReaderCategory
- type ReaderCategoryEngine
- type ReaderCategoryTimings
- type ReaderConfig
- type ReaderImageProxy
- type ReaderImageProxyTimeouts
- type ReaderServer
- type ReaderTTL
- type Redis
- type Server
- type Settings
- type TTL
Constants ¶
const DefaultLocale string = "en_US"
Variables ¶
This section is empty.
Functions ¶
func NewAllEnabled ¶
func NewGeneral ¶ added in v0.10.0
func NewScience ¶ added in v0.10.0
func NewSettings ¶
Types ¶
type Badger ¶ added in v0.10.0
type Badger struct { // Setting this to false will result in badger not persisting the cache to disk making it run "in-memory" Persist bool `koanf:"persist"` }
type Category ¶
type Category struct { Engines []engines.Name Ranking CategoryRanking Timings CategoryTimings }
type CategoryEngineRanking ¶ added in v0.17.0
type CategoryRanking ¶ added in v0.17.0
type CategoryRanking struct { REXP float64 `koanf:"rexp"` A float64 `koanf:"a"` B float64 `koanf:"b"` C float64 `koanf:"c"` D float64 `koanf:"d"` TRA float64 `koanf:"tra"` TRB float64 `koanf:"trb"` TRC float64 `koanf:"trc"` TRD float64 `koanf:"trd"` Engines map[string]CategoryEngineRanking `koanf:"engines"` }
func EmptyRanking ¶ added in v0.10.0
func EmptyRanking() CategoryRanking
func NewRanking ¶
func NewRanking() CategoryRanking
type CategoryTimings ¶ added in v0.17.0
type CategoryTimings struct { // Minimum amount of time to wait before starting to check the number of results // Search will wait for at least this amount of time (unless all engines respond) PreferredTimeoutMin time.Duration // Maximum amount of time to wait until the number of results is satisfactory // Search will wait for at most this amount of time (unless all engines respond or the preferred number of results is found) PreferredTimeoutMax time.Duration // Preferred number of results to find PreferredResultsNumber int // Time of the steps for checking if the number of results is satisfactory StepTime time.Duration // Minimum number of results required after the maximum preferred time // If this number isn't met, the search will continue after the maximum preferred time MinimumResultsNumber int // Hard timeout after which the search is forcefully stopped (even if the engines didn't respond) HardTimeout time.Duration // Colly delay Delay time.Duration // Colly random delay RandomDelay time.Duration // Colly parallelism Parallelism int }
Delegates Timeout, PageTimeout to colly.Collector.SetRequestTimeout(); Note: See https://github.com/gocolly/colly/issues/644 Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit()
type Config ¶
type ImageProxy ¶ added in v0.17.0
type ImageProxy struct { Salt string Timeouts ImageProxyTimeouts }
type ImageProxyTimeouts ¶ added in v0.17.0
type ReaderCache ¶ added in v0.10.0
type ReaderCache struct { // Can be "none", "badger" or "redis" Type string `koanf:"type"` // Prefix to use for cache keys KeyPrefix string `koanf:"keyprefix"` // Has no effect if type is "none" TTL ReaderTTL `koanf:"ttl"` // Badger specific settings Badger Badger `koanf:"badger"` // Redis specific settings Redis Redis `koanf:"redis"` }
ReaderCache is format in which the config is read from the config file
type ReaderCategory ¶
type ReaderCategory struct { REngines map[string]ReaderCategoryEngine `koanf:"engines"` Ranking CategoryRanking `koanf:"ranking"` RTimings ReaderCategoryTimings `koanf:"timings"` }
ReaderCategory is format in which the config is read from the config file
type ReaderCategoryEngine ¶ added in v0.17.0
type ReaderCategoryEngine struct {
Enabled bool `koanf:"enabled"`
}
ReaderEngine is format in which the config is read from the config file
type ReaderCategoryTimings ¶ added in v0.17.0
type ReaderCategoryTimings struct { // Minimum amount of time to wait before starting to check the number of results // Search will wait for at least this amount of time (unless all engines respond) PreferredTimeoutMin string `koanf:"preferredtimeoutmin"` // Maximum amount of time to wait until the number of results is satisfactory // Search will wait for at most this amount of time (unless all engines respond or the preferred number of results is found) PreferredTimeoutMax string `koanf:"preferredtimeoutmax"` // Preferred number of results to find PreferredResultsNumber int `koanf:"preferredresultsnumber"` // Time of the steps for checking if the number of results is satisfactory StepTime string `koanf:"steptime"` // Minimum number of results required after the maximum preferred time // If this number isn't met, the search will continue after the maximum preferred time MinimumResultsNumber int `koanf:"minimumresultsnumber"` // Hard timeout after which the search is forcefully stopped (even if the engines didn't respond) HardTimeout string `koanf:"hardtimeout"` // Colly delay Delay string `koanf:"delay"` // Colly random delay RandomDelay string `koanf:"randomdelay"` // Colly parallelism Parallelism int `koanf:"parallelism"` }
ReaderTimings is format in which the config is read from the config file In <number><unit> format Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y If unit is not specified, it is assumed to be milliseconds Delegates Timeout, PageTimeout to colly.Collector.SetRequestTimeout(); Note: See https://github.com/gocolly/colly/issues/644 Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit()
type ReaderConfig ¶
type ReaderConfig struct { Server ReaderServer `koanf:"server"` RCategories map[category.Name]ReaderCategory `koanf:"categories"` Settings map[string]Settings `koanf:"settings"` }
ReaderConfig is format in which the config is read from the config file
type ReaderImageProxy ¶ added in v0.17.0
type ReaderImageProxy struct { Salt string `koanf:"salt"` Timeouts ReaderImageProxyTimeouts `koanf:"timeouts"` }
ReaderProxy is format in which the config is read from the config file
type ReaderImageProxyTimeouts ¶ added in v0.17.0
type ReaderImageProxyTimeouts struct { Dial string `koanf:"dial"` KeepAlive string `koanf:"keepalive"` TLSHandshake string `koanf:"tlshandshake"` }
ReaderProxyTimeouts is format in which the config is read from the config file In <number><unit> format Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y If unit is not specified, it is assumed to be milliseconds
type ReaderServer ¶ added in v0.10.0
type ReaderServer struct { // Environment in which the server is running (normal or lambda) Environment string `koanf:"environment"` // Port on which the API server listens Port int `koanf:"port"` // URLs used for CORS (wildcards allowed) // comma separated FrontendUrls string `koanf:"frontendurls"` // Cache settings Cache ReaderCache `koanf:"cache"` // Image proxy settings Proxy ReaderImageProxy `koanf:"proxy"` }
ReaderServer is format in which the config is read from the config file
type ReaderTTL ¶ added in v0.10.0
type ReaderTTL struct { // how long to store the results in cache // setting this to 0 caches the results forever Time string `koanf:"time"` // if the remaining TTL when retrieving from cache is less than this, update the cache entry and reset the TTL // setting this to 0 disables this feature // setting this to the same value (or higher) as Results will update the cache entry every time RefreshTime string `koanf:"refreshtime"` }
ReaderTTL is format in which the config is read from the config file In <number><unit> format Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y If unit is not specified, it is assumed to be milliseconds
type Server ¶
type Server struct { // Environment in which the server is running (normal or lambda) Environment string // Port on which the API server listens Port int // URLs used for CORS (wildcards allowed) FrontendUrls []string // Cache settings Cache Cache // Image proxy settings Proxy ImageProxy }
type TTL ¶ added in v0.10.0
type TTL struct { // How long to store the results in cache // Setting this to 0 caches the results forever Time time.Duration // If the remaining TTL when retrieving from cache is less than this, update the cache entry and reset the TTL // Setting this to 0 disables this feature // Setting this to the same value (or higher) as Results will update the cache entry every time RefreshTime time.Duration }