search

package
v0.0.0-...-4ce0c85 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointProduction is the Search production endpoint
	EndpointProduction = "https://cloudplatform.coveo.com/rest/search/"
	// EndpointStaging is the Search staging endpoint
	EndpointStaging = "https://cloudplatformstaging.coveo.com/rest/search/"
	// EndpointDevelopment is the Search development endpoint
	EndpointDevelopment = "https://cloudplatformdev.coveo.com/rest/search/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Query(q Query) (*Response, error)
	ListFacetValues(field string, maximumNumberOfValues int) (*FacetValues, error)
}

Client is the search client to make search requests

func NewClient

func NewClient(c Config) (Client, error)

NewClient returns a configured http search client using default http client

type Config

type Config struct {
	Token     string
	UserAgent string
	// Endpoint is used if you want to use custom endpoints (dev,staging,testing)
	Endpoint string
}

Config is used to configure a new client

type FacetValue

type FacetValue struct {
	Value           string `json:"value"`
	LookupValue     string `json:"lookupValue"`
	NumberOfResults int    `json:"numberOfResults"`
}

type FacetValues

type FacetValues struct {
	Values []FacetValue `json:"values"`
}

type GroupByRequest

type GroupByRequest struct {
	Field                 string `json:"field"`
	MaximumNumberOfValues int    `json:"maximumNumberOfValues,omitempty"`
	SortCriteria          string `json:"sortCriteria,omitempty"`
	InjectionDepth        int    `json:"injectionDepth,omitempty"`
}

GroupByRequest Struct representing a GroupByRequest send to the index. It is used to send data to the facets of a search page.

type GroupByResult

type GroupByResult struct {
	Field  string `json:"field"`
	Values []struct {
		Value           string `json:"value"`
		NumberOfResults int    `json:"numberOfResults"`
		Score           int    `json:"score"`
		ValueType       string `json:"valueType"`
	} `json:"values"`
}

GroupByResult The result of a group by request to the index.

type Query

type Query struct {
	Q                     string            `json:"q,omitempty"`
	AQ                    string            `json:"aq,omitempty"`
	CQ                    string            `json:"cq,omitempty"`
	DQ                    string            `json:"dq,omitempty"`
	NumberOfResults       int               `json:"numberOfResults,omitempty"`
	FirstResult           int               `json:"firstResult,omitempty"`
	GroupByRequests       []*GroupByRequest `json:"groupBy,omitempty"`
	Tab                   string            `json:"tab,omitempty"`
	PartialMatch          bool              `json:"partialMatch,omitempty"`
	PartialMatchKeywords  int               `json:"partialMatchKeywords,omitempty"`
	PartialMatchThreshold string            `json:"partialMatchThreshold,omitempty"`
	Pipeline              string            `json:"pipeline,omitempty"`
}

Query Struct reprensenting a query sent to the index.

type Response

type Response struct {
	TotalCount         int             `json:"totalCount"`
	TotalCountFiltered int             `json:"totalCountFiltered"`
	Duration           int             `json:"duration"`
	IndexDuration      int             `json:"indexDuration"`
	RequestDuration    int             `json:"requestDuration"`
	SearchUID          string          `json:"searchUid"`
	Pipeline           string          `json:"pipeline"`
	GroupByResults     []GroupByResult `json:"groupByResults,omitempty"`
	Results            []Result        `json:"results,omitempty"`
	SplitTestRun       string          `json:"splitTestRun, omitempty"`
}

Response A collection of results from the Coveo index following a query. It contains the results that were returned from the query and some metadata.

type Result

type Result struct {
	Title          string                 `json:"title"`
	URI            string                 `json:"uri"`
	Excerpt        string                 `json:"excerpt"`
	FirstSentences string                 `json:"firstSentences"`
	Score          int                    `json:"score"`
	PercentScore   float32                `json:"percentScore"`
	ClickURI       string                 `json:"clickUri"`
	Raw            map[string]interface{} `json:"raw"`
}

Result A single result returned from a query to the Coveo index.

Jump to

Keyboard shortcuts

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