search

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a search api client that can be used to make requests to the server

func New

func New(searchAPIURL string) *Client

New creates a new instance of Client with a given search api url

func NewWithHealthClient added in v1.25.0

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

func (c *Client) Checker(ctx context.Context, check *health.CheckState) error

Checker calls search api health endpoint and returns a check object to the caller.

func (*Client) Dimension

func (c *Client) Dimension(ctx context.Context, datasetID, edition, version, name, query string, params ...Config) (m *Model, err error)

Dimension allows the searching of a dimension for a specific dimension option, optionally pass in configuration parameters as an additional field. This can include a request specific internal token

type Config

type Config struct {
	Limit         *int
	Offset        *int
	InternalToken string
	FlorenceToken string
}

Config represents configuration required to conduct a search request

type ErrInvalidSearchAPIResponse

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

ErrInvalidSearchAPIResponse is returned when the search api does not respond with a valid status

func (ErrInvalidSearchAPIResponse) Code

Code returns the status code received from search api if an error is returned

func (ErrInvalidSearchAPIResponse) Error

Error should be called by the user to print out the stringified version of the error

type Item

type Item struct {
	Code               string  `json:"code,omitempty"`
	DimensionOptionURL string  `json:"dimension_option_url,omitempty"`
	HasData            bool    `json:"has_data,omitempty"`
	Label              string  `json:"label,omitempty"`
	Matches            Matches `json:"matches,omitempty"`
	NumberOfChildren   int     `json:"number_of_children,omitempty"`
}

Item represents a single hierarchy item returned by the search api

type Match

type Match struct {
	Start int `json:"start,omitempty"`
	End   int `json:"end,omitempty"`
}

Match defines the start and end character numbers that the item matched with

type Matches

type Matches struct {
	Code  []Match `json:"code,omitempty"`
	Label []Match `json:"label,omitempty"`
}

Matches represent matches from the input query against the returned item

type Model

type Model struct {
	Count      int    `json:"count"`
	Items      []Item `json:"items"`
	Limit      int    `json:"limit"`
	Offset     int    `json:"offset"`
	TotalCount int    `json:"total_count"`
}

Model represents a model returned by the search api

Jump to

Keyboard shortcuts

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