analyze

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Performs the analysis process on a text and return the tokens breakdown of the text.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type Analyze

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

func New

Performs the analysis process on a text and return the tokens breakdown of the text.

https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html

func (Analyze) Do

func (r Analyze) Do(ctx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a analyze.Response

func (*Analyze) Header

func (r *Analyze) Header(key, value string) *Analyze

Header set a key, value pair in the Analyze headers map.

func (*Analyze) HttpRequest

func (r *Analyze) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*Analyze) Index

func (r *Analyze) Index(v string) *Analyze

Index The name of the index to scope the operation API Name: index

func (Analyze) Perform

func (r Analyze) Perform(ctx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*Analyze) Raw

func (r *Analyze) Raw(raw io.Reader) *Analyze

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*Analyze) Request

func (r *Analyze) Request(req *Request) *Analyze

Request allows to set the request property with the appropriate payload.

type NewAnalyze

type NewAnalyze func() *Analyze

NewAnalyze type alias for index.

func NewAnalyzeFunc

func NewAnalyzeFunc(tp elastictransport.Interface) NewAnalyze

NewAnalyzeFunc returns a new instance of Analyze with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request struct {
	Analyzer   *string             `json:"analyzer,omitempty"`
	Attributes []string            `json:"attributes,omitempty"`
	CharFilter []types.CharFilter  `json:"char_filter,omitempty"`
	Explain    *bool               `json:"explain,omitempty"`
	Field      *string             `json:"field,omitempty"`
	Filter     []types.TokenFilter `json:"filter,omitempty"`
	Normalizer *string             `json:"normalizer,omitempty"`
	Text       []string            `json:"text,omitempty"`
	Tokenizer  types.Tokenizer     `json:"tokenizer,omitempty"`
}

Request holds the request body struct for the package analyze

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/indices/analyze/IndicesAnalyzeRequest.ts#L27-L47

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

type Response

type Response struct {
	Detail *types.AnalyzeDetail `json:"detail,omitempty"`
	Tokens []types.AnalyzeToken `json:"tokens,omitempty"`
}

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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