swiftype: github.com/mnhkahn/swiftype Index | Examples | Files

package swiftype

import "github.com/mnhkahn/swiftype"

This is a Golang client for swiftype. Only support search.

For more information, refer to the official [documentation](https://swiftype.com/documentation/quickstart)

Code:

SWIFTYPE := *swiftype.Client
SWIFTYPE_APIKEY := "YOUR OWN API KEY"
SWIFTYPE_HOST := "api.swiftype.com"
SWIFTYPE_ENGINE := "YOUR OWN ENGINE"

SWIFTYPE := swiftype.NewClientWithApiKey(SWIFTYPE_APIKEY, SWIFTYPE_HOST)

data, err := SWIFTYPE.Search(SWIFTYPE_ENGINE, q)
if err != nil {
    panic(err)
}
_ = data

Index

Examples

Package Files

client.go doc.go result.go

Constants

const (
    VERSION               = "1.0.0"
    USER_AGENT            = "Swiftype-Go/" + VERSION
    DEFAULT_API_HOST      = "api.swiftype.com"
    DEFAULT_API_BASE_PATH = "/api/v1/"
)

type Client Uses

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

func NewClientWithApiKey Uses

func NewClientWithApiKey(api_key string, host string) *Client

func NewClientWithUsernamePassword Uses

func NewClientWithUsernamePassword(username string, password string, host string) *Client

func (*Client) Engine Uses

func (c *Client) Engine(engine string) ([]byte, error)

func (*Client) Engines Uses

func (c *Client) Engines() ([]byte, error)

func (*Client) Search Uses

func (c *Client) Search(engine string, sp *SearchParam) (*SwiftypeResult, error)

type SearchParam Uses

type SearchParam struct {
    Q       string
    Page    int
    PerPage int
}

func NewSearchParam Uses

func NewSearchParam(q string) *SearchParam

func NewSearchParamLimit Uses

func NewSearchParamLimit(q string, page, per_page int) *SearchParam

func (*SearchParam) Query Uses

func (sp *SearchParam) Query() string

type SwiftypeResult Uses

type SwiftypeResult struct {
    Errors struct{} `json:"errors"`
    Info   struct {
        Page struct {
            CurrentPage      int      `json:"current_page"`
            Facets           struct{} `json:"facets"`
            NumPages         int      `json:"num_pages"`
            PerPage          int      `json:"per_page"`
            Query            string   `json:"query"`
            TotalResultCount int      `json:"total_result_count"`
        } `json:"page"`
    }   `json:"info"`
    RecordCount int `json:"record_count"`
    Records     struct {
        Page []struct {
            Explanation interface{} `json:"_explanation"`
            Index       string      `json:"_index"`
            Score       float64     `json:"_score"`
            Typee       string      `json:"_type"`
            Version     interface{} `json:"_version"`
            Body        string      `json:"body"`
            ExternalID  string      `json:"external_id"`
            Highlight   struct {
                Body  string `json:"body"`
                Title string `json:"title"`
            }   `json:"highlight"`
            ID          string        `json:"id"`
            Image       string        `json:"image"`
            Info        string        `json:"info"`
            Popularity  int           `json:"popularity"`
            PublishedAt string        `json:"published_at"`
            Sections    []interface{} `json:"sections"`
            Sort        interface{}   `json:"sort"`
            Title       string        `json:"title"`
            Type        string        `json:"type"`
            UpdatedAt   string        `json:"updated_at"`
            URL         string        `json:"url"`
        } `json:"page"`
    }   `json:"records"`
}

Swiftype

Package swiftype imports 7 packages (graph). Updated 2018-09-10. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).