service

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PanicGuideURL = "https://runbooks.in.ft.com/"

Variables

View Source
var (
	NoContentError  = &SuggesterErr{msg: "Suggestion API returned HTTP 204"}
	BadRequestError = &SuggesterErr{msg: "Suggestion API returned HTTP 400"}

	PseudoConceptTypeAuthor = "author"

	PersonSourceParam       = "personSource"
	LocationSourceParam     = "locationSource"
	OrganisationSourceParam = "organisationSource"
	TopicSourceParam        = "topicSource"
)

Functions

This section is empty.

Types

type AggregateSuggester

type AggregateSuggester struct {
	Concordance     *ConcordanceService
	BroaderProvider *BroaderConceptsProvider
	Blacklister     ConceptBlacklister
	Suggesters      []Suggester
	Log             *logger.UPPLogger
}

func NewAggregateSuggester

func NewAggregateSuggester(log *logger.UPPLogger, concordance *ConcordanceService, broaderConceptsProvider *BroaderConceptsProvider, blacklister ConceptBlacklister, suggesters ...Suggester) *AggregateSuggester

func (*AggregateSuggester) GetSuggestions

func (s *AggregateSuggester) GetSuggestions(payload []byte, tid, origin string) (SuggestionsResponse, error)

GetSuggestions calls several services to build it's return value.

It calls concurrently the Suggesters and the Blacklister and waits them. It then calls the BroaderProvider to exclude the broader concepts.

payload is the content send to the Suggesters. tid is propaged down the request chain. origin is propaged down only to the Suggesters.

type AuthorsSuggester

type AuthorsSuggester struct {
	SuggestionApi
}

func NewAuthorsSuggester

func NewAuthorsSuggester(authorsSuggestionApiBaseURL, authorsSuggestionEndpoint string, client Client) *AuthorsSuggester

type Blacklist

type Blacklist struct {
	UUIDS []string `json:"uuids"`
}

type Blacklister

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

func (*Blacklister) Check

func (b *Blacklister) Check() v1_1.Check

func (*Blacklister) GetBlacklist

func (b *Blacklister) GetBlacklist(tid string) (Blacklist, error)

func (*Blacklister) IsBlacklisted

func (b *Blacklister) IsBlacklisted(conceptId string, bl Blacklist) bool

type BroaderConcept

type BroaderConcept struct {
	ID string `json:"id"`
}

type BroaderConceptsProvider

type BroaderConceptsProvider struct {
	PublicThingsBaseURL  string
	PublicThingsEndpoint string
	Client               Client
	// contains filtered or unexported fields
}

func NewBroaderConceptsProvider

func NewBroaderConceptsProvider(publicThingsAPIBaseURL, publicThingsEndpoint string, client Client) *BroaderConceptsProvider

func (*BroaderConceptsProvider) Check

func (b *BroaderConceptsProvider) Check() v1_1.Check

type Client

type Client interface {
	Do(req *http.Request) (resp *http.Response, err error)
}

type Concept

type Concept struct {
	ID         string `json:"id"`
	APIURL     string `json:"apiUrl,omitempty"`
	Type       string `json:"type,omitempty"`
	PrefLabel  string `json:"prefLabel,omitempty"`
	IsFTAuthor bool   `json:"isFTAuthor,omitempty"`
}

type ConceptBlacklister

type ConceptBlacklister interface {
	IsBlacklisted(uuid string, bl Blacklist) bool
	GetBlacklist(tid string) (Blacklist, error)
	Check() v1_1.Check
}

func NewConceptBlacklister

func NewConceptBlacklister(baseUrl string, endpoint string, client Client) ConceptBlacklister

type ConcordanceResponse

type ConcordanceResponse struct {
	Concepts map[string]Concept `json:"concepts"`
}

type ConcordanceService

type ConcordanceService struct {
	ConcordanceBaseURL  string
	ConcordanceEndpoint string
	Client              Client
	// contains filtered or unexported fields
}

func NewConcordance

func NewConcordance(internalConcordancesApiBaseURL, internalConcordancesEndpoint string, client Client) *ConcordanceService

func (*ConcordanceService) Check

func (concordance *ConcordanceService) Check() v1_1.Check

type OntotextSuggester

type OntotextSuggester struct {
	SuggestionApi
}

func NewOntotextSuggester

func NewOntotextSuggester(ontotextSuggestionApiBaseURL, ontotextSuggestionEndpoint string, client Client) *OntotextSuggester

type Suggester

type Suggester interface {
	GetSuggestions(payload []byte, tid, origin string) (SuggestionsResponse, error)
	FilterSuggestions(suggestions []Suggestion) []Suggestion
	GetName() string
}

type SuggesterErr added in v1.6.3

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

SuggesterErr is error type returned suggester GetSuggestions method

func (*SuggesterErr) Error added in v1.6.3

func (s *SuggesterErr) Error() string

func (*SuggesterErr) Unwrap added in v1.6.3

func (s *SuggesterErr) Unwrap() error

type Suggestion

type Suggestion struct {
	Concept
	Predicate string `json:"predicate,omitempty"`
}

type SuggestionApi

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

func (*SuggestionApi) Check

func (suggester *SuggestionApi) Check() health.Check

func (*SuggestionApi) FilterSuggestions

func (suggester *SuggestionApi) FilterSuggestions(suggestions []Suggestion) []Suggestion

func (*SuggestionApi) GetName

func (suggester *SuggestionApi) GetName() string

func (*SuggestionApi) GetSuggestions

func (suggester *SuggestionApi) GetSuggestions(payload []byte, tid, origin string) (SuggestionsResponse, error)

type SuggestionsResponse

type SuggestionsResponse struct {
	Suggestions []Suggestion `json:"suggestions"`
}

type Thing

type Thing struct {
	ID              string           `json:"id"`
	BroaderConcepts []BroaderConcept `json:"broaderConcepts"`
}

Jump to

Keyboard shortcuts

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