Documentation ¶
Index ¶
- type Breakdown
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) GetDepartments(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, ...) (d Department, err error)
- func (c *Client) GetReleases(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, ...) (ReleaseResponse, error)
- func (c *Client) GetSearch(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, ...) (r Response, err error)
- type Contact
- type ContentItem
- type Department
- type DepartmentItem
- type DepartmentMatch
- type Description
- type ErrInvalidSearchResponse
- type FilterCount
- type Highlight
- type LegacyDescription
- type MatchDetails
- type Matches
- type Release
- type ReleaseDateChange
- type ReleaseDescription
- type ReleaseResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breakdown ¶ added in v2.104.0
type Breakdown struct { Total int `json:"total"` Provisional int `json:"provisional,omitempty"` Confirmed int `json:"confirmed,omitempty"` Postponed int `json:"postponed,omitempty"` Published int `json:"published,omitempty"` Cancelled int `json:"cancelled,omitempty"` Census int `json:"census,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a dp-search-api client which can be used to make requests to the server
func NewWithHealthClient ¶
func NewWithHealthClient(hcCli *healthcheck.Client) *Client
NewWithHealthClient creates a new instance of Client, reusing the URL and Clienter from the provided health check client.
func (*Client) Checker ¶
Checker calls search api health endpoint and returns a check object to the caller.
func (*Client) GetDepartments ¶
func (c *Client) GetDepartments(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, query url.Values) (d Department, err error)
GetDepartments returns the search results
func (*Client) GetReleases ¶ added in v2.104.0
func (c *Client) GetReleases(ctx context.Context, userAuthToken, serviceAuthToken, collectionID string, query url.Values) (ReleaseResponse, error)
GetReleases returns the search results for published Releases and upcoming Release Calendar entries
type Contact ¶
type Contact struct { Name string `json:"name"` Telephone string `json:"telephone,omitempty"` Email string `json:"email"` }
Contact represents each search result contact details
type ContentItem ¶
type ContentItem struct { Description LegacyDescription LegacyDescription `json:"description"` Type string `json:"type"` URI string `json:"uri"` Matches *Matches `json:"matches,omitempty"` }
ContentItem represents each search result
type Department ¶
type Department struct { Count int `json:"count"` Took int `json:"took"` Items *[]DepartmentItem `json:"items"` }
Department represents response from /departments/search end point
type DepartmentItem ¶
type DepartmentItem struct { Code string `json:"code"` Name string `json:"name"` URL string `json:"url"` Matches *[]DepartmentMatch `json:"matches"` }
DepartmentItem represents a department
type DepartmentMatch ¶
type DepartmentMatch struct {
Terms *[]MatchDetails `json:"terms"`
}
DepartmentMatch represents a department matches term
type Description ¶
type Description struct { CDID string `json:"cdid"` DatasetID string `json:"dataset_id"` Keywords []string `json:"keywords"` MetaDescription string `json:"meta_description"` ReleaseDate string `json:"release_date,omitempty"` Summary string `json:"summary"` Title string `json:"title"` Topics []string `json:"topics"` Highlight *Highlight `json:"highlight,omitempty"` DateChanges []ReleaseDateChange `json:"date_changes,omitempty"` Cancelled bool `json:"cancelled,omitempty"` Finalised bool `json:"finalised,omitempty"` ProvisionalDate string `json:"provisional_date,omitempty"` Published bool `json:"published,omitempty"` Language string `json:"language,omitempty"` Survey string `json:"survey,omitempty"` }
Description represents each search result which is given from data in ES 7.10
type ErrInvalidSearchResponse ¶
type ErrInvalidSearchResponse struct {
// contains filtered or unexported fields
}
ErrInvalidSearchResponse is returned when the dp-search-api does not respond with a valid status
func NewSearchErrorResponse ¶
func NewSearchErrorResponse(resp *http.Response, uri string) (e *ErrInvalidSearchResponse)
NewSearchErrorResponse creates an error response
func (ErrInvalidSearchResponse) Code ¶
func (e ErrInvalidSearchResponse) Code() int
Code returns the status code received from dp-search-api if an error is returned
func (ErrInvalidSearchResponse) Error ¶
func (e ErrInvalidSearchResponse) Error() string
Error should be called by the user to print out the stringified version of the error
type FilterCount ¶ added in v2.144.0
FilterCount represents the specific filter type for the search results with its respective count
type Highlight ¶ added in v2.4.3
type Highlight struct { Title string `json:"title,omitempty"` Keywords *[]string `json:"keywords,omitempty"` Summary string `json:"summary,omitempty"` MetaDescription string `json:"meta_description,omitempty"` DatasetID string `json:"dataset_id,omitempty"` Edition string `json:"edition,omitempty"` Topics []string `json:"topics,omitempty"` }
Highlight contains specific metadata with search keyword(s) highlighted
type LegacyDescription ¶ added in v2.146.0
type LegacyDescription struct { CanonicalTopic string `json:"canonical_topic,omitempty"` Contact *Contact `json:"contact,omitempty"` DatasetID string `json:"dataset_id,omitempty"` Edition string `json:"edition,omitempty"` Headline1 string `json:"headline1,omitempty"` Headline2 string `json:"headline2,omitempty"` Headline3 string `json:"headline3,omitempty"` Keywords *[]string `json:"keywords,omitempty"` LatestRelease *bool `json:"latest_release,omitempty"` Language string `json:"language,omitempty"` MetaDescription string `json:"meta_description,omitempty"` NationalStatistic *bool `json:"national_statistic,omitempty"` NextRelease string `json:"next_release,omitempty"` PreUnit string `json:"pre_unit,omitempty"` ReleaseDate string `json:"release_date,omitempty"` Source string `json:"source,omitempty"` Summary string `json:"summary"` Title string `json:"title"` Topics []string `json:"topics,omitempty"` Unit string `json:"unit,omitempty"` Highlight Highlight `json:"highlight,omitempty"` }
LegacyDescription represents each search result description which is given from data in ES 2.2
type MatchDetails ¶
type MatchDetails struct { Value string `json:"value,omitempty"` Start int `json:"start"` End int `json:"end"` }
MatchDetails represents each search result matches' details
type Matches ¶
type Matches struct { Description struct { Summary *[]MatchDetails `json:"summary"` Title *[]MatchDetails `json:"title"` Edition *[]MatchDetails `json:"edition,omitempty"` MetaDescription *[]MatchDetails `json:"meta_description,omitempty"` Keywords *[]MatchDetails `json:"keywords,omitempty"` DatasetID *[]MatchDetails `json:"dataset_id,omitempty"` } `json:"description"` }
Matches represents each search result matches
type Release ¶ added in v2.104.0
type Release struct { URI string `json:"uri"` DateChanges []ReleaseDateChange `json:"date_changes"` Description ReleaseDescription `json:"description"` Highlight *Highlight `json:"highlight,omitempty"` }
type ReleaseDateChange ¶ added in v2.104.0
type ReleaseDescription ¶ added in v2.104.0
type ReleaseDescription struct { Title string `json:"title"` Summary string `json:"summary"` ReleaseDate string `json:"release_date"` Published bool `json:"published"` Cancelled bool `json:"cancelled"` Finalised bool `json:"finalised"` Postponed bool `json:"postponed"` Census bool `json:"census"` Keywords []string `json:"keywords,omitempty"` ProvisionalDate string `json:"provisional_date,omitempty"` Language string `json:"language,omitempty"` }
type ReleaseResponse ¶ added in v2.104.0
type ReleaseResponse struct { Took int `json:"took"` Breakdown Breakdown `json:"breakdown"` Releases []Release `json:"releases"` }
ReleaseResponse represents response from /search/releases endpoint
type Response ¶
type Response struct { ES_710 bool `json:"es_710"` Count int `json:"count"` ContentTypes []FilterCount `json:"content_types"` DistinctTopicCount int `json:"distinct_topics_count"` Items []ContentItem `json:"items"` Suggestions []string `json:"suggestions,omitempty"` Topics []FilterCount `json:"topics"` AdditionalSuggestions []string `json:"additional_suggestions,omitempty"` }
Response represents the fields for the search results as returned by dp-search-api