New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cancel task api for v0.30.0 #395
Changes from 2 commits
478217b
6d8eaed
d629950
c41800e
d6bce8a
15f1b43
d4c6242
a55baa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -130,25 +130,21 @@ type Task struct { | |||||||||||||||||||||||||||||||||||||||||||||
StartedAt time.Time `json:"startedAt,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
FinishedAt time.Time `json:"finishedAt,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Details Details `json:"details,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
CanceledBy int64 `json:"canceledBy,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
// TaskInfo indicates information regarding a task returned by an asynchronous method | ||||||||||||||||||||||||||||||||||||||||||||||
// | ||||||||||||||||||||||||||||||||||||||||||||||
// Documentation: https://docs.meilisearch.com/reference/api/tasks.html#tasks | ||||||||||||||||||||||||||||||||||||||||||||||
type TaskInfo struct { | ||||||||||||||||||||||||||||||||||||||||||||||
Status TaskStatus `json:"status"` | ||||||||||||||||||||||||||||||||||||||||||||||
TaskUID int64 `json:"taskUid,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
IndexUID string `json:"indexUid"` | ||||||||||||||||||||||||||||||||||||||||||||||
Type string `json:"type"` | ||||||||||||||||||||||||||||||||||||||||||||||
Error meilisearchApiError `json:"error,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Duration string `json:"duration,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
EnqueuedAt time.Time `json:"enqueuedAt"` | ||||||||||||||||||||||||||||||||||||||||||||||
StartedAt time.Time `json:"startedAt,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
FinishedAt time.Time `json:"finishedAt,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Details Details `json:"details,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Status TaskStatus `json:"status"` | ||||||||||||||||||||||||||||||||||||||||||||||
TaskUID int64 `json:"taskUid"` | ||||||||||||||||||||||||||||||||||||||||||||||
IndexUID string `json:"indexUid"` | ||||||||||||||||||||||||||||||||||||||||||||||
Type string `json:"type"` | ||||||||||||||||||||||||||||||||||||||||||||||
EnqueuedAt time.Time `json:"enqueuedAt"` | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
// TasksQuery is the request body for list documents method | ||||||||||||||||||||||||||||||||||||||||||||||
// TasksQuery is a list of filter available to send as query parameters | ||||||||||||||||||||||||||||||||||||||||||||||
type TasksQuery struct { | ||||||||||||||||||||||||||||||||||||||||||||||
UIDS []int64 | ||||||||||||||||||||||||||||||||||||||||||||||
Limit int64 | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -165,16 +161,39 @@ type TasksQuery struct { | |||||||||||||||||||||||||||||||||||||||||||||
AfterFinishedAt time.Time | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
// CancelTasksQuery is a list of filter available to send as query parameters | ||||||||||||||||||||||||||||||||||||||||||||||
type CancelTasksQuery struct { | ||||||||||||||||||||||||||||||||||||||||||||||
UIDS []int64 | ||||||||||||||||||||||||||||||||||||||||||||||
IndexUIDS []string | ||||||||||||||||||||||||||||||||||||||||||||||
Statuses []string | ||||||||||||||||||||||||||||||||||||||||||||||
Types []string | ||||||||||||||||||||||||||||||||||||||||||||||
BeforeEnqueuedAt time.Time | ||||||||||||||||||||||||||||||||||||||||||||||
AfterEnqueuedAt time.Time | ||||||||||||||||||||||||||||||||||||||||||||||
BeforeStartedAt time.Time | ||||||||||||||||||||||||||||||||||||||||||||||
AfterStartedAt time.Time | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+165
to
+174
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't add those two filters because they didn't make sense, and they are not in the parameters available in the documentation. Are you sure it's a good think to add it? |
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
type Details struct { | ||||||||||||||||||||||||||||||||||||||||||||||
ReceivedDocuments int `json:"receivedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
IndexedDocuments int `json:"indexedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
DeletedDocuments int `json:"deletedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
ReceivedDocuments int64 `json:"receivedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
IndexedDocuments int64 `json:"indexedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
DeletedDocuments int64 `json:"deletedDocuments,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
PrimaryKey string `json:"primaryKey,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
ProvidedIds int64 `json:"providedIds,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
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"` | ||||||||||||||||||||||||||||||||||||||||||||||
TypoTolerance *TypoTolerance `json:"typoTolerance,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Pagination *Pagination `json:"pagination,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
Faceting *Faceting `json:"faceting,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
MatchedTasks int64 `json:"matchedTasks,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
CanceledTasks int64 `json:"canceledTasks,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
DeletedTasks int64 `json:"deletedTasks,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
OriginalFilter string `json:"originalFilter,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
// Return of multiple tasks is wrap in a TaskResult | ||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this function
encodeTasksQuery
support multiple sets of params?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I could put
interface{}
as a parameter instead of a typed struct, but I wouldn't have access to the fields easily.