mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-23 23:21:27 +00:00
Commit from m3o/m3o action
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
)
|
||||
|
||||
type Search interface {
|
||||
CreateIndex(*CreateIndexRequest) (*CreateIndexResponse, error)
|
||||
DeleteIndex(*DeleteIndexRequest) (*DeleteIndexResponse, error)
|
||||
Delete(*DeleteRequest) (*DeleteResponse, error)
|
||||
Index(*IndexRequest) (*IndexResponse, error)
|
||||
@@ -23,6 +24,14 @@ type SearchService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Create a search index by name
|
||||
func (t *SearchService) CreateIndex(request *CreateIndexRequest) (*CreateIndexResponse, error) {
|
||||
|
||||
rsp := &CreateIndexResponse{}
|
||||
return rsp, t.client.Call("search", "CreateIndex", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
// Delete an index.
|
||||
func (t *SearchService) DeleteIndex(request *DeleteIndexRequest) (*DeleteIndexResponse, error) {
|
||||
|
||||
@@ -56,8 +65,10 @@ func (t *SearchService) Search(request *SearchRequest) (*SearchResponse, error)
|
||||
}
|
||||
|
||||
type CreateIndexRequest struct {
|
||||
Fields []Field `json:"fields"`
|
||||
// the name of the index
|
||||
//
|
||||
// TODO: allow fields to index
|
||||
// repeated Field fields = 2;
|
||||
Index string `json:"index"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user