search

package
v1.33.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 11 Imported by: 3

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 dp-search-query client which can be used to make requests to the server

func NewClient

func NewClient(searchAPIURL string) *Client

NewClient creates a new instance of Client with a given search-query api url

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) GetSearch

func (c *Client) GetSearch(ctx context.Context, query url.Values) (r Response, err error)

GetSearch returns the search results

type ContentType added in v1.30.1

type ContentType struct {
	Type  string `json:"type"`
	Count int    `json:"count"`
}

ContentType represents the specific content type for the search results with its respective count

type ErrInvalidSearchResponse

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

ErrInvalidSearchResponse is returned when the dp-search-query 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-query 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 Response

type Response struct {
	Count        int           `json:"count"`
	ContentTypes []ContentType `json:"content_types"`
	Items        []contentItem `json:"items"`
	Suggestions  []string      `json:"suggestions,omitempty"`
}

Response represents the fields for the search results as returned by dp-search-query

Jump to

Keyboard shortcuts

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