Documentation
¶
Index ¶
- Constants
- type AsyncUpdateID
- type Client
- func (c *Client) CreateDump() (resp *Dump, err error)
- func (c *Client) CreateIndex(config *IndexConfig) (resp *Index, err error)
- func (c *Client) DeleteIndex(uid string) (ok bool, err error)
- func (c *Client) DeleteIndexIfExists(uid string) (ok bool, err error)
- func (c *Client) GetAllIndexes() (resp []*Index, err error)
- func (c *Client) GetAllRawIndexes() (resp []map[string]interface{}, err error)
- func (c *Client) GetAllStats() (resp *Stats, err error)
- func (c *Client) GetDumpStatus(dumpUID string) (resp *Dump, err error)
- func (c *Client) GetIndex(uid string) (resp *Index, err error)
- func (c *Client) GetKeys() (resp *Keys, err error)
- func (c *Client) GetOrCreateIndex(config *IndexConfig) (resp *Index, err error)
- func (c *Client) GetRawIndex(uid string) (resp map[string]interface{}, err error)
- func (c *Client) GetVersion() (resp *Version, err error)
- func (c *Client) Health() (resp *Health, err error)
- func (c *Client) Index(uid string) *Index
- func (c *Client) IsHealthy() bool
- func (v Client) MarshalEasyJSON(w *jwriter.Writer)
- func (v Client) MarshalJSON() ([]byte, error)
- func (v *Client) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Client) UnmarshalJSON(data []byte) error
- func (c *Client) Version() (resp *Version, err error)
- type ClientConfig
- type ClientInterface
- type CreateIndexRequest
- type DocumentsRequest
- type Dump
- type DumpStatus
- type ErrCode
- type Error
- type Health
- type Index
- func (i Index) AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) AddDocumentsCsvFromReader(documents io.Reader, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) AddDocumentsCsvFromReaderInBatches(documents io.Reader, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) AddDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) AddDocumentsNdjson(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) AddDocumentsNdjsonFromReader(documents io.Reader, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) AddDocumentsNdjsonFromReaderInBatches(documents io.Reader, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) AddDocumentsNdjsonInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) DefaultWaitForPendingUpdate(updateID *AsyncUpdateID) (UpdateStatus, error)
- func (i Index) Delete(uid string) (ok bool, err error)
- func (i Index) DeleteAllDocuments() (resp *AsyncUpdateID, err error)
- func (i Index) DeleteDocument(identifier string) (resp *AsyncUpdateID, err error)
- func (i Index) DeleteDocuments(identifier []string) (resp *AsyncUpdateID, err error)
- func (i Index) DeleteIfExists(uid string) (ok bool, err error)
- func (i Index) FetchInfo() (resp *Index, err error)
- func (i Index) FetchPrimaryKey() (resp *string, err error)
- func (i Index) GetAllUpdateStatus() (resp *[]Update, err error)
- func (i Index) GetDisplayedAttributes() (resp *[]string, err error)
- func (i Index) GetDistinctAttribute() (resp *string, err error)
- func (i Index) GetDocument(identifier string, documentPtr interface{}) error
- func (i Index) GetDocuments(request *DocumentsRequest, resp interface{}) error
- func (i Index) GetFilterableAttributes() (resp *[]string, err error)
- func (i Index) GetRankingRules() (resp *[]string, err error)
- func (i Index) GetSearchableAttributes() (resp *[]string, err error)
- func (i Index) GetSettings() (resp *Settings, err error)
- func (i Index) GetSortableAttributes() (resp *[]string, err error)
- func (i Index) GetStats() (resp *StatsIndex, err error)
- func (i Index) GetStopWords() (resp *[]string, err error)
- func (i Index) GetSynonyms() (resp *map[string][]string, err error)
- func (i Index) GetUpdateStatus(updateID int64) (resp *Update, err error)
- func (v Index) MarshalEasyJSON(w *jwriter.Writer)
- func (v Index) MarshalJSON() ([]byte, error)
- func (i Index) ResetDisplayedAttributes() (resp *AsyncUpdateID, err error)
- func (i Index) ResetDistinctAttribute() (resp *AsyncUpdateID, err error)
- func (i Index) ResetFilterableAttributes() (resp *AsyncUpdateID, err error)
- func (i Index) ResetRankingRules() (resp *AsyncUpdateID, err error)
- func (i Index) ResetSearchableAttributes() (resp *AsyncUpdateID, err error)
- func (i Index) ResetSettings() (resp *AsyncUpdateID, err error)
- func (i Index) ResetSortableAttributes() (resp *AsyncUpdateID, err error)
- func (i Index) ResetStopWords() (resp *AsyncUpdateID, err error)
- func (i Index) ResetSynonyms() (resp *AsyncUpdateID, err error)
- func (i Index) Search(query string, request *SearchRequest) (*SearchResponse, error)
- func (v *Index) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Index) UnmarshalJSON(data []byte) error
- func (i Index) UpdateDisplayedAttributes(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateDistinctAttribute(request string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
- func (i Index) UpdateFilterableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateIndex(primaryKey string) (resp *Index, err error)
- func (i Index) UpdateRankingRules(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateSearchableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateSettings(request *Settings) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateSortableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateStopWords(request *[]string) (resp *AsyncUpdateID, err error)
- func (i Index) UpdateSynonyms(request *map[string][]string) (resp *AsyncUpdateID, err error)
- func (i Index) WaitForPendingUpdate(ctx context.Context, interval time.Duration, updateID *AsyncUpdateID) (UpdateStatus, error)
- type IndexConfig
- type IndexInterface
- type Keys
- type RawType
- type SearchRequest
- type SearchResponse
- type Settings
- type Stats
- type StatsIndex
- type Unknown
- type Update
- type UpdateIndexRequest
- type UpdateStatus
- type Version
Constants ¶
const (
DefaultLimit int64 = 20
)
This constant contains the default values assigned by meilisearch to the limit in search parameters
Documentation: https://docs.meilisearch.com/reference/features/search_parameters.html
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncUpdateID ¶
type AsyncUpdateID struct {
UpdateID int64 `json:"updateId"`
}
AsyncUpdateID is returned for asynchronous method
Documentation: https://docs.meilisearch.com/learn/advanced/asynchronous_updates.html
func (AsyncUpdateID) MarshalEasyJSON ¶
func (v AsyncUpdateID) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AsyncUpdateID) MarshalJSON ¶
func (v AsyncUpdateID) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AsyncUpdateID) UnmarshalEasyJSON ¶
func (v *AsyncUpdateID) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AsyncUpdateID) UnmarshalJSON ¶
func (v *AsyncUpdateID) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a structure that give you the power for interacting with an high-level api with meilisearch.
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates Meilisearch with default fasthttp.Client
func NewFastHTTPCustomClient ¶
func NewFastHTTPCustomClient(config ClientConfig, client *fasthttp.Client) *Client
NewFastHTTPCustomClient creates Meilisearch with custom fasthttp.Client
func (*Client) CreateDump ¶
func (*Client) CreateIndex ¶
func (c *Client) CreateIndex(config *IndexConfig) (resp *Index, err error)
func (*Client) DeleteIndexIfExists ¶
func (*Client) GetAllIndexes ¶
func (*Client) GetAllRawIndexes ¶
func (*Client) GetAllStats ¶
func (*Client) GetDumpStatus ¶
func (*Client) GetOrCreateIndex ¶
func (c *Client) GetOrCreateIndex(config *IndexConfig) (resp *Index, err error)
func (*Client) GetRawIndex ¶
func (*Client) GetVersion ¶
func (Client) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Client) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Client) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Client) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ClientConfig ¶
type ClientConfig struct {
// Host is the host of your meilisearch database
// Example: 'http://localhost:7700'
Host string
// APIKey is optional
APIKey string
// Timeout is optional
Timeout time.Duration
}
ClientConfig configure the Client
type ClientInterface ¶
type ClientInterface interface {
Index(uid string) *Index
GetIndex(indexID string) (resp *Index, err error)
GetRawIndex(uid string) (resp map[string]interface{}, err error)
GetAllIndexes() (resp []*Index, err error)
GetAllRawIndexes() (resp []map[string]interface{}, err error)
CreateIndex(config *IndexConfig) (resp *Index, err error)
GetOrCreateIndex(config *IndexConfig) (resp *Index, err error)
DeleteIndex(uid string) (bool, error)
DeleteIndexIfExists(uid string) (bool, error)
GetKeys() (resp *Keys, err error)
GetAllStats() (resp *Stats, err error)
CreateDump() (resp *Dump, err error)
GetDumpStatus(dumpUID string) (resp *Dump, err error)
Version() (*Version, error)
GetVersion() (resp *Version, err error)
Health() (*Health, error)
IsHealthy() bool
}
ClientInterface is interface for all Meilisearch client
type CreateIndexRequest ¶
type CreateIndexRequest struct {
UID string `json:"uid,omitempty"`
PrimaryKey string `json:"primaryKey,omitempty"`
}
CreateIndexRequest is the request body for create index method
func (CreateIndexRequest) MarshalEasyJSON ¶
func (v CreateIndexRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (CreateIndexRequest) MarshalJSON ¶
func (v CreateIndexRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*CreateIndexRequest) UnmarshalEasyJSON ¶
func (v *CreateIndexRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*CreateIndexRequest) UnmarshalJSON ¶
func (v *CreateIndexRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type DocumentsRequest ¶
type DocumentsRequest struct {
Offset int64 `json:"offset,omitempty"`
Limit int64 `json:"limit,omitempty"`
AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
}
DocumentsRequest is the request body for list documents method
func (DocumentsRequest) MarshalEasyJSON ¶
func (v DocumentsRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DocumentsRequest) MarshalJSON ¶
func (v DocumentsRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DocumentsRequest) UnmarshalEasyJSON ¶
func (v *DocumentsRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DocumentsRequest) UnmarshalJSON ¶
func (v *DocumentsRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Dump ¶
type Dump struct {
UID string `json:"uid"`
Status DumpStatus `json:"status"`
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
}
Dump indicate information about an dump
Documentation: https://docs.meilisearch.com/reference/api/dump.html
func (Dump) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Dump) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Dump) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Dump) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type DumpStatus ¶
type DumpStatus string
DumpStatus is the status of a dump.
const ( // DumpStatusInProgress means the server is processing the dump DumpStatusInProgress DumpStatus = "in_progress" // DumpStatusFailed means the server failed to create a dump DumpStatusFailed DumpStatus = "failed" // DumpStatusDone means the server completed the dump DumpStatusDone DumpStatus = "done" )
type ErrCode ¶
type ErrCode int
ErrCode are all possible errors found during requests
const ( // ErrCodeUnknown default error code, undefined ErrCodeUnknown ErrCode = 0 // ErrCodeMarshalRequest impossible to serialize request body ErrCodeMarshalRequest ErrCode = iota + 1 // ErrCodeResponseUnmarshalBody impossible deserialize the response body ErrCodeResponseUnmarshalBody // MeilisearchApiError send by the Meilisearch api MeilisearchApiError // MeilisearchApiError send by the Meilisearch api MeilisearchApiErrorWithoutMessage // MeilisearchTimeoutError MeilisearchTimeoutError // MeilisearchCommunicationError impossible execute a request MeilisearchCommunicationError )
type Error ¶
type Error struct {
// Endpoint is the path of the request (host is not in)
Endpoint string
// Method is the HTTP verb of the request
Method string
// Function name used
Function string
// RequestToString is the raw request into string ('empty request' if not present)
RequestToString string
// RequestToString is the raw request into string ('empty response' if not present)
ResponseToString string
// Error info from Meilisearch api
// Message is the raw request into string ('empty meilisearch message' if not present)
MeilisearchApiError meilisearchApiError
// StatusCode of the request
StatusCode int
// StatusCode expected by the endpoint to be considered as a success
StatusCodeExpected []int
// OriginError is the origin error that produce the current Error. It can be nil in case of a bad status code.
OriginError error
// ErrCode is the internal error code that represent the different step when executing a request that can produce
// an error.
ErrCode ErrCode
// contains filtered or unexported fields
}
Error is the internal error structure that all exposed method use. So ALL errors returned by this library can be cast to this struct (as a pointer)
type Health ¶
type Health struct {
Status string `json:"status"`
}
Health is the request body for set Meilisearch health
func (Health) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Health) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Health) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Health) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Index ¶
type Index struct {
UID string `json:"uid"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
PrimaryKey string `json:"primaryKey,omitempty"`
// contains filtered or unexported fields
}
Index is the type that represent an index in MeiliSearch
func (Index) AddDocuments ¶
func (i Index) AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
func (Index) AddDocumentsCsv ¶
func (i Index) AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
func (Index) AddDocumentsCsvFromReader ¶
func (Index) AddDocumentsCsvFromReaderInBatches ¶
func (Index) AddDocumentsCsvInBatches ¶
func (Index) AddDocumentsInBatches ¶
func (i Index) AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
func (Index) AddDocumentsNdjson ¶
func (i Index) AddDocumentsNdjson(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
func (Index) AddDocumentsNdjsonFromReader ¶
func (Index) AddDocumentsNdjsonFromReaderInBatches ¶
func (Index) AddDocumentsNdjsonInBatches ¶
func (Index) DefaultWaitForPendingUpdate ¶
func (i Index) DefaultWaitForPendingUpdate(updateID *AsyncUpdateID) (UpdateStatus, error)
DefaultWaitForPendingUpdate checks each 50ms the status of a WaitForPendingUpdate. This is a default implementation of WaitForPendingUpdate.
func (Index) DeleteAllDocuments ¶
func (i Index) DeleteAllDocuments() (resp *AsyncUpdateID, err error)
func (Index) DeleteDocument ¶
func (i Index) DeleteDocument(identifier string) (resp *AsyncUpdateID, err error)
func (Index) DeleteDocuments ¶
func (i Index) DeleteDocuments(identifier []string) (resp *AsyncUpdateID, err error)
func (Index) FetchPrimaryKey ¶
func (Index) GetAllUpdateStatus ¶
func (Index) GetDisplayedAttributes ¶
func (Index) GetDistinctAttribute ¶
func (Index) GetDocument ¶
func (Index) GetDocuments ¶
func (i Index) GetDocuments(request *DocumentsRequest, resp interface{}) error
func (Index) GetFilterableAttributes ¶
func (Index) GetRankingRules ¶
func (Index) GetSearchableAttributes ¶
func (Index) GetSettings ¶
func (Index) GetSortableAttributes ¶
func (Index) GetStats ¶
func (i Index) GetStats() (resp *StatsIndex, err error)
func (Index) GetStopWords ¶
func (Index) GetUpdateStatus ¶
func (Index) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Index) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (Index) ResetDisplayedAttributes ¶
func (i Index) ResetDisplayedAttributes() (resp *AsyncUpdateID, err error)
func (Index) ResetDistinctAttribute ¶
func (i Index) ResetDistinctAttribute() (resp *AsyncUpdateID, err error)
func (Index) ResetFilterableAttributes ¶
func (i Index) ResetFilterableAttributes() (resp *AsyncUpdateID, err error)
func (Index) ResetRankingRules ¶
func (i Index) ResetRankingRules() (resp *AsyncUpdateID, err error)
func (Index) ResetSearchableAttributes ¶
func (i Index) ResetSearchableAttributes() (resp *AsyncUpdateID, err error)
func (Index) ResetSettings ¶
func (i Index) ResetSettings() (resp *AsyncUpdateID, err error)
func (Index) ResetSortableAttributes ¶
func (i Index) ResetSortableAttributes() (resp *AsyncUpdateID, err error)
func (Index) ResetStopWords ¶
func (i Index) ResetStopWords() (resp *AsyncUpdateID, err error)
func (Index) ResetSynonyms ¶
func (i Index) ResetSynonyms() (resp *AsyncUpdateID, err error)
func (Index) Search ¶
func (i Index) Search(query string, request *SearchRequest) (*SearchResponse, error)
func (*Index) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Index) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
func (Index) UpdateDisplayedAttributes ¶
func (i Index) UpdateDisplayedAttributes(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateDistinctAttribute ¶
func (i Index) UpdateDistinctAttribute(request string) (resp *AsyncUpdateID, err error)
func (Index) UpdateDocuments ¶
func (i Index) UpdateDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
func (Index) UpdateDocumentsInBatches ¶
func (i Index) UpdateDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
func (Index) UpdateFilterableAttributes ¶
func (i Index) UpdateFilterableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateRankingRules ¶
func (i Index) UpdateRankingRules(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateSearchableAttributes ¶
func (i Index) UpdateSearchableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateSettings ¶
func (i Index) UpdateSettings(request *Settings) (resp *AsyncUpdateID, err error)
func (Index) UpdateSortableAttributes ¶
func (i Index) UpdateSortableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateStopWords ¶
func (i Index) UpdateStopWords(request *[]string) (resp *AsyncUpdateID, err error)
func (Index) UpdateSynonyms ¶
func (i Index) UpdateSynonyms(request *map[string][]string) (resp *AsyncUpdateID, err error)
func (Index) WaitForPendingUpdate ¶
func (i Index) WaitForPendingUpdate( ctx context.Context, interval time.Duration, updateID *AsyncUpdateID) (UpdateStatus, error)
WaitForPendingUpdate waits for the end of an update. The function will check by regular interval provided in parameter interval the UpdateStatus. If it is not UpdateStatusEnqueued or the ctx cancelled we return the UpdateStatus.
type IndexConfig ¶
type IndexConfig struct {
// Uid is the unique identifier of a given index.
Uid string
// PrimaryKey is optional
PrimaryKey string
// contains filtered or unexported fields
}
IndexConfig configure the Index
type IndexInterface ¶
type IndexInterface interface {
FetchInfo() (resp *Index, err error)
FetchPrimaryKey() (resp *string, err error)
UpdateIndex(primaryKey string) (resp *Index, err error)
Delete(uid string) (ok bool, err error)
DeleteIfExists(uid string) (ok bool, err error)
GetStats() (resp *StatsIndex, err error)
AddDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
AddDocumentsInBatches(documentsPtr interface{}, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
AddDocumentsCsv(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
AddDocumentsCsvInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
AddDocumentsNdjson(documents []byte, primaryKey ...string) (resp *AsyncUpdateID, err error)
AddDocumentsNdjsonInBatches(documents []byte, batchSize int, primaryKey ...string) (resp []AsyncUpdateID, err error)
UpdateDocuments(documentsPtr interface{}, primaryKey ...string) (resp *AsyncUpdateID, err error)
GetDocument(uid string, documentPtr interface{}) error
GetDocuments(request *DocumentsRequest, resp interface{}) error
DeleteDocument(uid string) (resp *AsyncUpdateID, err error)
DeleteDocuments(uid []string) (resp *AsyncUpdateID, err error)
DeleteAllDocuments() (resp *AsyncUpdateID, err error)
Search(query string, request *SearchRequest) (*SearchResponse, error)
GetUpdateStatus(updateID int64) (resp *Update, err error)
GetAllUpdateStatus() (resp *[]Update, err error)
GetSettings() (resp *Settings, err error)
UpdateSettings(request *Settings) (resp *AsyncUpdateID, err error)
ResetSettings() (resp *AsyncUpdateID, err error)
GetRankingRules() (resp *[]string, err error)
UpdateRankingRules(request *[]string) (resp *AsyncUpdateID, err error)
ResetRankingRules() (resp *AsyncUpdateID, err error)
GetDistinctAttribute() (resp *string, err error)
UpdateDistinctAttribute(request string) (resp *AsyncUpdateID, err error)
ResetDistinctAttribute() (resp *AsyncUpdateID, err error)
GetSearchableAttributes() (resp *[]string, err error)
UpdateSearchableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
ResetSearchableAttributes() (resp *AsyncUpdateID, err error)
GetDisplayedAttributes() (resp *[]string, err error)
UpdateDisplayedAttributes(request *[]string) (resp *AsyncUpdateID, err error)
ResetDisplayedAttributes() (resp *AsyncUpdateID, err error)
GetStopWords() (resp *[]string, err error)
UpdateStopWords(request *[]string) (resp *AsyncUpdateID, err error)
ResetStopWords() (resp *AsyncUpdateID, err error)
GetSynonyms() (resp *map[string][]string, err error)
UpdateSynonyms(request *map[string][]string) (resp *AsyncUpdateID, err error)
ResetSynonyms() (resp *AsyncUpdateID, err error)
GetFilterableAttributes() (resp *[]string, err error)
UpdateFilterableAttributes(request *[]string) (resp *AsyncUpdateID, err error)
ResetFilterableAttributes() (resp *AsyncUpdateID, err error)
WaitForPendingUpdate(ctx context.Context, interval time.Duration, updateID *AsyncUpdateID) (UpdateStatus, error)
DefaultWaitForPendingUpdate(updateID *AsyncUpdateID) (UpdateStatus, error)
}
type Keys ¶
type Keys struct {
Public string `json:"public,omitempty"`
Private string `json:"private,omitempty"`
}
Keys allow the user to connect to the MeiliSearch instance
Documentation: https://docs.meilisearch.com/learn/advanced/asynchronous_updates.html
func (Keys) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Keys) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Keys) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Keys) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type RawType ¶
type RawType []byte
RawType is an alias for raw byte[]
func (RawType) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*RawType) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type SearchRequest ¶
type SearchRequest struct {
Offset int64
Limit int64
AttributesToRetrieve []string
AttributesToCrop []string
CropLength int64
AttributesToHighlight []string
Filter interface{}
Matches bool
FacetsDistribution []string
PlaceholderSearch bool
Sort []string
}
SearchRequest is the request url param needed for a search query. This struct will be converted to url param before sent.
Documentation: https://docs.meilisearch.com/reference/features/search_parameters.html
func (SearchRequest) MarshalEasyJSON ¶
func (v SearchRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SearchRequest) MarshalJSON ¶
func (v SearchRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SearchRequest) UnmarshalEasyJSON ¶
func (v *SearchRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SearchRequest) UnmarshalJSON ¶
func (v *SearchRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SearchResponse ¶
type SearchResponse struct {
Hits []interface{} `json:"hits"`
NbHits int64 `json:"nbHits"`
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
ExhaustiveNbHits bool `json:"exhaustiveNbHits"`
ProcessingTimeMs int64 `json:"processingTimeMs"`
Query string `json:"query"`
FacetsDistribution interface{} `json:"facetsDistribution,omitempty"`
ExhaustiveFacetsCount interface{} `json:"exhaustiveFacetsCount,omitempty"`
}
SearchResponse is the response body for search method
func (SearchResponse) MarshalEasyJSON ¶
func (v SearchResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SearchResponse) MarshalJSON ¶
func (v SearchResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SearchResponse) UnmarshalEasyJSON ¶
func (v *SearchResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SearchResponse) UnmarshalJSON ¶
func (v *SearchResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Settings ¶
type Settings struct {
RankingRules []string `json:"rankingRules,omitempty"`
DistinctAttribute *string `json:"distinctAttribute,omitempty"`
SearchableAttributes []string `json:"searchableAttributes,omitempty"`
DisplayedAttributes []string `json:"displayedAttributes,omitempty"`
StopWords []string `json:"stopWords,omitempty"`
Synonyms map[string][]string `json:"synonyms,omitempty"`
FilterableAttributes []string `json:"filterableAttributes,omitempty"`
SortableAttributes []string `json:"sortableAttributes,omitempty"`
}
Settings is the type that represents the settings in MeiliSearch
func (Settings) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Settings) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Settings) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Settings) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Stats ¶
type Stats struct {
DatabaseSize int64 `json:"databaseSize"`
LastUpdate time.Time `json:"lastUpdate"`
Indexes map[string]StatsIndex `json:"indexes"`
}
Stats is the type that represent all stats
func (Stats) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Stats) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Stats) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Stats) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type StatsIndex ¶
type StatsIndex struct {
NumberOfDocuments int64 `json:"numberOfDocuments"`
IsIndexing bool `json:"isIndexing"`
FieldDistribution map[string]int64 `json:"fieldDistribution"`
}
StatsIndex is the type that represent the stats of an index in MeiliSearch
func (StatsIndex) MarshalEasyJSON ¶
func (v StatsIndex) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (StatsIndex) MarshalJSON ¶
func (v StatsIndex) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*StatsIndex) UnmarshalEasyJSON ¶
func (v *StatsIndex) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*StatsIndex) UnmarshalJSON ¶
func (v *StatsIndex) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Update ¶
type Update struct {
Status UpdateStatus `json:"status"`
UpdateID int64 `json:"updateId"`
Type Unknown `json:"type"`
Error string `json:"error"`
EnqueuedAt time.Time `json:"enqueuedAt"`
ProcessedAt time.Time `json:"processedAt"`
}
Update indicate information about an update
func (Update) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Update) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Update) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Update) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type UpdateIndexRequest ¶
type UpdateIndexRequest struct {
PrimaryKey string `json:"primaryKey"`
}
UpdateIndexRequest is the request body for update Index primary key
func (UpdateIndexRequest) MarshalEasyJSON ¶
func (v UpdateIndexRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UpdateIndexRequest) MarshalJSON ¶
func (v UpdateIndexRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UpdateIndexRequest) UnmarshalEasyJSON ¶
func (v *UpdateIndexRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UpdateIndexRequest) UnmarshalJSON ¶
func (v *UpdateIndexRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type UpdateStatus ¶
type UpdateStatus string
UpdateStatus is the status of an update.
const ( // UpdateStatusUnknown is the default UpdateStatus, should not exist UpdateStatusUnknown UpdateStatus = "unknown" // UpdateStatusEnqueued means the server know the update but didn't handle it yet UpdateStatusEnqueued UpdateStatus = "enqueued" // UpdateStatusProcessing means the server is processing the update and all went well UpdateStatusProcessing UpdateStatus = "processing" // UpdateStatusProcessed means the server has processed the update and all went well UpdateStatusProcessed UpdateStatus = "processed" // UpdateStatusFailed means the server has processed the update and an error has been reported UpdateStatusFailed UpdateStatus = "failed" )
type Version ¶
type Version struct {
CommitSha string `json:"commitSha"`
CommitDate string `json:"commitDate"`
PkgVersion string `json:"pkgVersion"`
}
Version is the type that represents the versions in MeiliSearch
func (Version) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Version) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Version) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Version) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface