Package autocomplete provides methods for interacting directly with auto complete models.



    This section is empty.


    This section is empty.


    This section is empty.


    type Client

    type Client struct {
    	// contains filtered or unexported fields

      Client provides methods for interacting directly with auto-complete models.

      func New

      func New(client *sajari.Client, name string) *Client

        New creates a new client for interacting with auto complete models.

        func (*Client) Complete

        func (c *Client) Complete(ctx context.Context, phrase string, terms []string) ([]string, error)

          Complete takes a phrase and its term components and returns an ordered array of potential completion matches. The terms are used to assist with spelling corrections and fuzzy matching, while the phrase is used as a prefix sequence.

          func (*Client) TrainCorpus

          func (c *Client) TrainCorpus(ctx context.Context, terms []string) error

            TrainCorpus takes an array of terms and uses them to train an autocomplete model for spelling correction (i.e. these terms must correctly spelt).

            func (*Client) TrainQuery

            func (c *Client) TrainQuery(ctx context.Context, phrase string) error

              TrainQuery takes a query phrase and uses it to train an autocomplete model for partial queries. The phrase should be a successful query (i.e. good spelling and return useful results).

              Source Files