result

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSuggestionsToOutput added in v0.22.0

func ConvertSuggestionsToOutput(suggestions []Suggestion) []string

Types

type ConcMapper added in v0.22.0

type ConcMapper[T any] interface {
	AddOrUpgrade(T)
}

type General

type General struct {
	// contains filtered or unexported fields
}

func (*General) AppendEngineRanks

func (r *General) AppendEngineRanks(rank Rank)

func (General) ConvertToOutput

func (r General) ConvertToOutput(salt string) ResultOutput

func (General) Description

func (r General) Description() string

func (General) EngineRanks

func (r General) EngineRanks() []Rank

func (*General) InitEngineRanks added in v0.22.0

func (r *General) InitEngineRanks()

func (General) Key added in v0.22.0

func (r General) Key() string

func (General) Rank

func (r General) Rank() int

func (General) Score

func (r General) Score() float64

func (*General) SetDescription

func (r *General) SetDescription(desc string)

func (*General) SetRank

func (r *General) SetRank(rank int)

func (*General) SetScore

func (r *General) SetScore(score float64)

func (General) Shorten

func (r General) Shorten(maxTitleLength int, maxDescriptionLength int) Result

Changes the title and description of the result to be at most N and M characters long respectively.

func (*General) ShrinkEngineRanks

func (r *General) ShrinkEngineRanks()

func (General) Title

func (r General) Title() string

func (General) URL

func (r General) URL() string

type GeneralOutput added in v0.22.0

type GeneralOutput struct {
	// contains filtered or unexported fields
}

type GeneralScraped

type GeneralScraped struct {
	// contains filtered or unexported fields
}

func ConstructResult

func ConstructResult(seName engines.Name, urll string, title string, description string, page int, onPageRank int) (GeneralScraped, error)

func (GeneralScraped) Convert

func (r GeneralScraped) Convert(erCap int) Result

func (GeneralScraped) Description

func (r GeneralScraped) Description() string

func (GeneralScraped) Key added in v0.22.0

func (r GeneralScraped) Key() string

func (GeneralScraped) Rank

func (r GeneralScraped) Rank() RankScraped

func (GeneralScraped) Title

func (r GeneralScraped) Title() string

func (GeneralScraped) URL

func (r GeneralScraped) URL() string

type ImageFormat

type ImageFormat struct {
	Height int `json:"height"`
	Width  int `json:"width"`
}

type Images

type Images struct {
	// contains filtered or unexported fields
}

func (Images) ConvertToOutput

func (r Images) ConvertToOutput(salt string) ResultOutput

func (Images) OriginalSize

func (r Images) OriginalSize() ImageFormat

func (Images) Shorten

func (r Images) Shorten(maxTitleLength int, maxDescriptionLength int) Result

func (Images) SourceName

func (r Images) SourceName() string

func (Images) SourceURL

func (r Images) SourceURL() string

func (Images) ThumbnailSize

func (r Images) ThumbnailSize() ImageFormat

func (Images) ThumbnailURL

func (r Images) ThumbnailURL() string

type ImagesOutput

type ImagesOutput struct {
	// contains filtered or unexported fields
}

type ImagesScraped

type ImagesScraped struct {
	GeneralScraped
	// contains filtered or unexported fields
}

func ConstructImagesResult

func ConstructImagesResult(
	seName engines.Name, urll string, title string, description string, page int, onPageRank int,
	originalHeight int, originalWidth int, thumbnailHeight int, thumbnailWidth int,
	thumbnailUrl string, sourceName string, sourceUrl string,
) (ImagesScraped, error)

func (ImagesScraped) Convert

func (r ImagesScraped) Convert(erCap int) Result

func (ImagesScraped) OriginalSize

func (r ImagesScraped) OriginalSize() scrapedImageFormat

func (ImagesScraped) SourceName

func (r ImagesScraped) SourceName() string

func (ImagesScraped) SourceURL

func (r ImagesScraped) SourceURL() string

func (ImagesScraped) ThumbnailSize

func (r ImagesScraped) ThumbnailSize() scrapedImageFormat

func (ImagesScraped) ThumbnailURL

func (r ImagesScraped) ThumbnailURL() string

type Rank

type Rank struct {
	RankSimple
	// contains filtered or unexported fields
}

func NewRank

func NewRank(searchEngine engines.Name, rank, page, onPageRank int) Rank

func (Rank) OnPageRank

func (r Rank) OnPageRank() int

func (Rank) Page

func (r Rank) Page() int

func (*Rank) SetOnPageRank

func (r *Rank) SetOnPageRank(onPageRank int)

func (*Rank) SetPage

func (r *Rank) SetPage(page, onPageRank int)

func (*Rank) UpgradeIfBetter added in v0.22.0

func (r *Rank) UpgradeIfBetter(newR Rank)

type RankScraped

type RankScraped struct {
	RankSimpleScraped
	// contains filtered or unexported fields
}

func NewRankScraped

func NewRankScraped(searchEngine engines.Name, rank, page, onPageRank int) RankScraped

func (RankScraped) Convert

func (r RankScraped) Convert() Rank

func (RankScraped) OnPageRank

func (r RankScraped) OnPageRank() int

func (RankScraped) Page

func (r RankScraped) Page() int

type RankSimple added in v0.22.0

type RankSimple struct {
	// contains filtered or unexported fields
}

func (RankSimple) Rank added in v0.22.0

func (r RankSimple) Rank() int

func (RankSimple) SearchEngine added in v0.22.0

func (r RankSimple) SearchEngine() engines.Name

func (*RankSimple) SetRank added in v0.22.0

func (r *RankSimple) SetRank(rank int)

func (*RankSimple) UpgradeIfBetter added in v0.22.0

func (r *RankSimple) UpgradeIfBetter(newR RankSimple)

type RankSimpleScraped added in v0.22.0

type RankSimpleScraped struct {
	// contains filtered or unexported fields
}

func NewRankSimpleScraped added in v0.22.0

func NewRankSimpleScraped(searchEngine engines.Name, rank int) RankSimpleScraped

func (RankSimpleScraped) Convert added in v0.22.0

func (r RankSimpleScraped) Convert() RankSimple

func (RankSimpleScraped) Rank added in v0.22.0

func (r RankSimpleScraped) Rank() int

func (RankSimpleScraped) SearchEngine added in v0.22.0

func (r RankSimpleScraped) SearchEngine() engines.Name

type Result

type Result interface {
	Key() string
	URL() string
	Title() string
	Description() string
	SetDescription(string)
	Rank() int
	SetRank(int)
	Score() float64
	SetScore(float64)
	EngineRanks() []Rank
	InitEngineRanks()
	ShrinkEngineRanks()
	AppendEngineRanks(Rank)
	ConvertToOutput(string) ResultOutput
	Shorten(int, int) Result
}

type ResultConcMap added in v0.22.0

type ResultConcMap struct {
	Mutex sync.RWMutex
	Map   map[string]Result
	// contains filtered or unexported fields
}

func NewResultMap added in v0.22.0

func NewResultMap(enabledEnginesLen, titleLen, descLen int) ResultConcMap

func (*ResultConcMap) AddOrUpgrade added in v0.22.0

func (m *ResultConcMap) AddOrUpgrade(val ResultScraped)

func (*ResultConcMap) ExtractWithResponders added in v0.22.0

func (m *ResultConcMap) ExtractWithResponders() ([]Result, []engines.Name)

type ResultOutput

type ResultOutput any

func ConvertToOutput

func ConvertToOutput(results []Result, salt string) []ResultOutput

type ResultScraped

type ResultScraped interface {
	Key() string
	URL() string
	Title() string
	Description() string
	Rank() RankScraped
	Convert(int) Result
}

type Suggestion added in v0.22.0

type Suggestion struct {
	// contains filtered or unexported fields
}

func (*Suggestion) AppendEngineRanks added in v0.22.0

func (s *Suggestion) AppendEngineRanks(rank RankSimple)

func (Suggestion) EngineRanks added in v0.22.0

func (s Suggestion) EngineRanks() []RankSimple

func (Suggestion) Rank added in v0.22.0

func (s Suggestion) Rank() int

func (Suggestion) Score added in v0.22.0

func (s Suggestion) Score() float64

func (*Suggestion) SetRank added in v0.22.0

func (s *Suggestion) SetRank(rank int)

func (*Suggestion) SetScore added in v0.22.0

func (s *Suggestion) SetScore(score float64)

func (*Suggestion) ShrinkEngineRanks added in v0.22.0

func (s *Suggestion) ShrinkEngineRanks()

func (Suggestion) Value added in v0.22.0

func (s Suggestion) Value() string

type SuggestionConcMap added in v0.22.0

type SuggestionConcMap struct {
	Mutex sync.RWMutex
	Map   map[string]Suggestion
	// contains filtered or unexported fields
}

func NewSuggestionMap added in v0.22.0

func NewSuggestionMap(enabledEnginesLen int) SuggestionConcMap

func (*SuggestionConcMap) AddOrUpgrade added in v0.22.0

func (m *SuggestionConcMap) AddOrUpgrade(val SuggestionScraped)

func (*SuggestionConcMap) ExtractWithResponders added in v0.22.0

func (m *SuggestionConcMap) ExtractWithResponders() ([]Suggestion, []engines.Name)

type SuggestionScraped added in v0.22.0

type SuggestionScraped struct {
	// contains filtered or unexported fields
}

func NewSuggestionScraped added in v0.22.0

func NewSuggestionScraped(value string, seName engines.Name, rank int) SuggestionScraped

func (SuggestionScraped) Convert added in v0.22.0

func (s SuggestionScraped) Convert(erCap int) Suggestion

func (SuggestionScraped) Key added in v0.22.0

func (s SuggestionScraped) Key() string

func (SuggestionScraped) Rank added in v0.22.0

func (SuggestionScraped) Value added in v0.22.0

func (s SuggestionScraped) Value() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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