Documentation
¶
Index ¶
- func IndexToRecords(index [][]index.Index) iter.Seq[Record]
- type Client
- type CreateKeyRequest
- type CreateKeyResponse
- type ErrorResponse
- type GetTaskResponse
- type Hit
- type Hits
- type JSONMarshal
- type JSONUnmarshal
- type MatchingStrategy
- type Record
- type RecordWithFormat
- type SearchFederationOptions
- type SearchRequest
- type SearchRequestHybrid
- type SearchResponse
- type SubmittedTaskResponse
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
func (*Client) BuildIndex ¶
type CreateKeyRequest ¶
type CreateKeyResponse ¶
type CreateKeyResponse struct {
CreateKeyRequest ` json:",inline"`
Key string `json:"key"`
}
type ErrorResponse ¶
type GetTaskResponse ¶
type GetTaskResponse struct {
UID int `json:"uid"`
IndexUID string `json:"indexUid"`
Status TaskStatus `json:"status"`
Type string `json:"type"`
CanceledBy int `json:"canceledBy"`
Details any `json:"details"`
Error ErrorResponse `json:"error"`
}
type Hit ¶
type Hit map[string]json.RawMessage // Hit is a map of key and value raw buffer
func (Hit) DecodeInto ¶
DecodeInto decodes a single Hit into the provided struct without intermediate marshaling.
func (Hit) DecodeWith ¶
func (h Hit) DecodeWith(vPtr any, marshal JSONMarshal, unmarshal JSONUnmarshal) error
DecodeWith decodes a Hit into the provided struct using the provided marshal and unmarshal functions.
type Hits ¶
type Hits []Hit // Hits is an alias for a slice of Hit.
func (Hits) DecodeInto ¶
DecodeInto decodes hs into the provided slice pointer without re-marshal. vSlicePtr must be a non-nil pointer to a slice whose element type is a struct or *struct. Example:
var out []exampleBookForTest
if err := hits.DecodeInto(&out); err != nil { ... }
var outPtr []*exampleBookForTest
if err := hits.DecodeInto(&outPtr); err != nil { ... }
func (Hits) DecodeWith ¶
func (h Hits) DecodeWith( vSlicePtr any, marshal JSONMarshal, unmarshal JSONUnmarshal, ) error
DecodeWith decodes a Hits into the provided struct using the provided marshal and unmarshal functions.
type JSONMarshal ¶
JSONMarshal returns the JSON encoding of v.
type JSONUnmarshal ¶
JSONUnmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.
type MatchingStrategy ¶
type MatchingStrategy string
const ( // Last returns documents containing all the query terms first. If there are not enough results containing all // query terms to meet the requested limit, Meilisearch will remove one query term at a time, // starting from the end of the query. Last MatchingStrategy = "last" // All only returns documents that contain all query terms. Meilisearch will not match any more documents even // if there aren't enough to meet the requested limit. All MatchingStrategy = "all" // Frequency returns documents containing all the query terms first. If there are not enough results containing //all query terms to meet the requested limit, Meilisearch will remove one query term at a time, starting //with the word that is the most frequent in the dataset. frequency effectively gives more weight to terms //that appear less frequently in a set of results. Frequency MatchingStrategy = "frequency" )
type Record ¶
type Record struct {
ObjectID string `json:"objectID"`
HierarchyLvl0 string `json:"hierarchy_lvl0,omitempty"`
HierarchyLvl1 string `json:"hierarchy_lvl1,omitempty"`
HierarchyLvl2 string `json:"hierarchy_lvl2,omitempty"`
HierarchyLvl3 string `json:"hierarchy_lvl3,omitempty"`
HierarchyLvl4 string `json:"hierarchy_lvl4,omitempty"`
HierarchyLvl5 string `json:"hierarchy_lvl5,omitempty"`
HierarchyLvl6 string `json:"hierarchy_lvl6,omitempty"`
Content string `json:"content"`
URL string `json:"url"`
Anchor string `json:"anchor"`
}
type RecordWithFormat ¶
type SearchFederationOptions ¶
type SearchRequest ¶
type SearchRequest struct {
Offset int64 `json:"offset,omitempty"`
Limit int64 `json:"limit,omitempty"`
AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"`
AttributesToCrop []string `json:"attributesToCrop,omitempty"`
CropLength int64 `json:"cropLength,omitempty"`
CropMarker string `json:"cropMarker,omitempty"`
AttributesToHighlight []string `json:"attributesToHighlight,omitempty"`
HighlightPreTag string `json:"highlightPreTag,omitempty"`
HighlightPostTag string `json:"highlightPostTag,omitempty"`
MatchingStrategy MatchingStrategy `json:"matchingStrategy,omitempty"`
Filter any `json:"filter,omitempty"`
ShowMatchesPosition bool `json:"showMatchesPosition,omitempty"`
ShowRankingScore bool `json:"showRankingScore,omitempty"`
ShowRankingScoreDetails bool `json:"showRankingScoreDetails,omitempty"`
Facets []string `json:"facets,omitempty"`
Sort []string `json:"sort,omitempty"`
Vector []float32 `json:"vector,omitempty"`
HitsPerPage int64 `json:"hitsPerPage,omitempty"`
Page int64 `json:"page,omitempty"`
IndexUID string `json:"indexUid,omitempty"`
Query string `json:"q"`
Distinct string `json:"distinct,omitempty"`
Hybrid *SearchRequestHybrid `json:"hybrid"`
RetrieveVectors bool `json:"retrieveVectors,omitempty"`
RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"`
FederationOptions *SearchFederationOptions `json:"federationOptions,omitempty"`
Locales []string `json:"locales,omitempty"`
Media map[string]any `json:"media,omitempty"`
}
SearchRequest is the request url param needed for a search query. This struct will be converted to url param before sent.
Documentation: https://www.meilisearch.com/docs/reference/api/search#search-parameters
type SearchRequestHybrid ¶
type SearchResponse ¶
type SearchResponse struct {
Hits Hits `json:"hits"`
EstimatedTotalHits int64 `json:"estimatedTotalHits,omitempty"`
Offset int64 `json:"offset,omitempty"`
Limit int64 `json:"limit,omitempty"`
ProcessingTimeMs int64 `json:"processingTimeMs"`
Query string `json:"query"`
FacetDistribution json.RawMessage `json:"facetDistribution,omitempty"`
TotalHits int64 `json:"totalHits,omitempty"`
HitsPerPage int64 `json:"hitsPerPage,omitempty"`
Page int64 `json:"page,omitempty"`
TotalPages int64 `json:"totalPages,omitempty"`
FacetStats json.RawMessage `json:"facetStats,omitempty"`
IndexUID string `json:"indexUid,omitempty"`
QueryVector *[]float32 `json:"queryVector,omitempty"`
}
SearchResponse is the response body for search method
type SubmittedTaskResponse ¶
type SubmittedTaskResponse struct {
TaskUID int `json:"taskUid"`
IndexUID string `json:"indexUid"`
Status TaskStatus `json:"status"`
Type string `json:"type"`
}
type TaskStatus ¶
type TaskStatus string
const ( // TaskStatusUnknown is the default TaskStatus, should not exist TaskStatusUnknown TaskStatus = "unknown" // TaskStatusEnqueued the task request has been received and will be processed soon TaskStatusEnqueued TaskStatus = "enqueued" // TaskStatusProcessing the task is being processed TaskStatusProcessing TaskStatus = "processing" // TaskStatusSucceeded the task has been successfully processed TaskStatusSucceeded TaskStatus = "succeeded" // TaskStatusFailed a failure occurred when processing the task, no changes were made to the database TaskStatusFailed TaskStatus = "failed" // TaskStatusCanceled the task was canceled TaskStatusCanceled TaskStatus = "canceled" )