search

package
v2.260.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 11 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(dimensionSearchAPIURL string) *Client

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

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

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

Checker calls dimension-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 ErrInvalidDimensionSearchAPIResponse

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

ErrInvalidDimensionSearchAPIResponse is returned when the dimension-search api does not respond with a valid status

func (ErrInvalidDimensionSearchAPIResponse) Code

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

func (ErrInvalidDimensionSearchAPIResponse) 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