Documentation
¶
Index ¶
- func NewErrLogger() elastic.Logger
- type AnswerPostDoc
- type ErrLogger
- type LoggingHttpClient
- type Operator
- func (op *Operator) CreateIndex(ctx context.Context, indexName string, mapping string) (err error)
- func (op *Operator) DeleteDoc(ctx context.Context, indexName string, id string) (err error)
- func (op *Operator) QueryDoc(ctx context.Context, indexName string, query elastic.Query, ...) (result *elastic.SearchResult, err error)
- func (op *Operator) SaveDoc(ctx context.Context, indexName string, id string, doc interface{}) (err error)
- type SearchContent
- type SearchEngine
- func (s *SearchEngine) ConfigFields() []plugin.ConfigField
- func (s *SearchEngine) ConfigReceiver(config []byte) error
- func (s *SearchEngine) DeleteContent(ctx context.Context, contentID string) error
- func (s *SearchEngine) Description() plugin.SearchDesc
- func (s *SearchEngine) Info() plugin.Info
- func (s *SearchEngine) RegisterSyncer(ctx context.Context, syncer plugin.SearchSyncer)
- func (s *SearchEngine) SearchAnswers(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)
- func (s *SearchEngine) SearchContents(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)
- func (s *SearchEngine) SearchQuestions(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)
- func (s *SearchEngine) UpdateContent(ctx context.Context, content *plugin.SearchContent) error
- type SearchEngineConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewErrLogger ¶
func NewErrLogger() elastic.Logger
Types ¶
type AnswerPostDoc ¶
type AnswerPostDoc struct {
Id string `json:"id"`
ObjectID string `json:"object_id"`
Title string `json:"title"`
Type string `json:"type"`
Content string `json:"content"`
UserID string `json:"user_id"`
QuestionID string `json:"question_id"`
Answers int64 `json:"answers"`
Status int64 `json:"status"`
Views int64 `json:"views"`
Created int64 `json:"created"`
Active int64 `json:"active"`
Score int64 `json:"score"`
HasAccepted bool `json:"has_accepted"`
Tags []string `json:"tags"`
}
func CreateDocFromSearchContent ¶
func CreateDocFromSearchContent(id string, content *plugin.SearchContent) (doc *AnswerPostDoc)
type LoggingHttpClient ¶
type LoggingHttpClient struct {
// contains filtered or unexported fields
}
type Operator ¶
type Operator struct {
C *elastic.Client
}
Operator elasticsearch client only support basic functions, not support bulk operations
func NewOperator ¶
func (*Operator) CreateIndex ¶
type SearchContent ¶
type SearchContent struct {
ObjectID string `json:"objectID"`
Title string `json:"title"`
Type string `json:"type"`
Content string `json:"content"`
Answers int64 `json:"answers"`
Status int64 `json:"status"`
Tags []string `json:"tags"`
QuestionID string `json:"questionID"`
UserID string `json:"userID"`
Views int64 `json:"views"`
Created int64 `json:"created"`
Active int64 `json:"active"`
Score int64 `json:"score"`
HasAccepted bool `json:"hasAccepted"`
}
type SearchEngine ¶
type SearchEngine struct {
Config *SearchEngineConfig
Operator *Operator
// contains filtered or unexported fields
}
func (*SearchEngine) ConfigFields ¶
func (s *SearchEngine) ConfigFields() []plugin.ConfigField
func (*SearchEngine) ConfigReceiver ¶
func (s *SearchEngine) ConfigReceiver(config []byte) error
func (*SearchEngine) DeleteContent ¶
func (s *SearchEngine) DeleteContent(ctx context.Context, contentID string) error
func (*SearchEngine) Description ¶
func (s *SearchEngine) Description() plugin.SearchDesc
func (*SearchEngine) Info ¶
func (s *SearchEngine) Info() plugin.Info
func (*SearchEngine) RegisterSyncer ¶
func (s *SearchEngine) RegisterSyncer(ctx context.Context, syncer plugin.SearchSyncer)
func (*SearchEngine) SearchAnswers ¶
func (s *SearchEngine) SearchAnswers( ctx context.Context, cond *plugin.SearchBasicCond) ( res []plugin.SearchResult, total int64, err error)
func (*SearchEngine) SearchContents ¶
func (s *SearchEngine) SearchContents( ctx context.Context, cond *plugin.SearchBasicCond) ( res []plugin.SearchResult, total int64, err error)
func (*SearchEngine) SearchQuestions ¶
func (s *SearchEngine) SearchQuestions( ctx context.Context, cond *plugin.SearchBasicCond) ( res []plugin.SearchResult, total int64, err error)
func (*SearchEngine) UpdateContent ¶
func (s *SearchEngine) UpdateContent(ctx context.Context, content *plugin.SearchContent) error
type SearchEngineConfig ¶
Click to show internal directories.
Click to hide internal directories.