analyticsrequest

package
v0.0.0-...-0fffe9f Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, analyticsrequest Record) context.Context

NewContext returns a new context with the given request body.

Types

type AnalyticsRequest

type AnalyticsRequest struct{}

func Instance

func Instance() *AnalyticsRequest

Instance returns the singleton instace of AnalyticsRequest plugin. Note: Only this function must be used (both within and outside the package) to obtain the instance AnalyticsRequest in order to avoid stateless instances of the plugin.

func (*AnalyticsRequest) AlternateRoutes

func (a *AnalyticsRequest) AlternateRoutes() []plugins.Route

Expose plugin specific routes

func (*AnalyticsRequest) ESMiddleware

func (c *AnalyticsRequest) ESMiddleware() []middleware.Middleware

func (*AnalyticsRequest) InitFunc

func (c *AnalyticsRequest) InitFunc() error

InitFunc is a part of Plugin interface that gets executed only once, and initializes the dao, i.e. elasticsearch before the plugin is operational.

func (*AnalyticsRequest) Name

func (f *AnalyticsRequest) Name() string

Name returns the name of the plugin: "analyticsrequest"

func (*AnalyticsRequest) RSMiddleware

func (c *AnalyticsRequest) RSMiddleware() []middleware.Middleware

func (*AnalyticsRequest) Routes

func (c *AnalyticsRequest) Routes() []plugins.Route

type CustomEvent

type CustomEvent struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

type HIT

type HIT struct {
	ID    string `json:"id"`
	Index string `json:"index"`
}

type Record

type Record struct {
	Took                        float64                      `json:"took,omitempty"`
	SearchQuery                 *string                      `json:"search_query,omitempty"`
	QueryLength                 *int                         `json:"search_characters_length,omitempty"`
	SearchQueryLength           *int                         `json:"search_query_length,omitempty"`
	Index                       string                       `json:"index,omitempty"`
	Indices                     []string                     `json:"indices,omitempty"`
	HitsInResponse              *[]HIT                       `json:"hits_in_response,omitempty"`
	TotalHits                   *int64                       `json:"total_hits,omitempty"`
	TimeStamp                   string                       `json:"timestamp,omitempty"`
	IP                          string                       `json:"ip,omitempty"`
	Location                    string                       `json:"location,omitempty"`
	Country                     string                       `json:"country,omitempty"`
	City                        string                       `json:"city,omitempty"`
	SearchFilters               *[]querytranslate.TermFilter `json:"search_filters,omitempty"`
	SearchState                 string                       `json:"search_state,omitempty"`
	UserID                      string                       `json:"user_id,omitempty"`
	ResultClickObjectIds        []string                     `json:"result_click_object_ids,omitempty"`
	ResultClickPositionIds      []int                        `json:"result_click_position_ids,omitempty"`
	SuggestionsClickObjectIds   []string                     `json:"suggestion_click_object_ids,omitempty"`
	SuggestionsClickPositionIds []int                        `json:"suggestion_click_position_ids,omitempty"`
	Conversion                  bool                         `json:"conversion,omitempty"`
	ConversionObjectIds         []string                     `json:"conversion_object_ids,omitempty"`
	StoredQueries               *[]string                    `json:"storedqueries,omitempty"`
	QueryRules                  *[]string                    `json:"queryrules,omitempty"`
	CustomEvents                []CustomEvent                `json:"custom_events,omitempty"` // Note: we save it differently
	URL                         *string                      `json:"url,omitempty"`
	Method                      *string                      `json:"method,omitempty"`
	Meta                        *map[string]interface{}      `json:"meta"`
}

Record represents the analytics doc for a record

func FromContext

func FromContext(ctx context.Context) (*Record, error)

FromContext retrieves the analyticsrequest against the ctxKey from the context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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