You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/internal/core/search.go

34 lines
673 B

package core
import (
"github.com/rocboss/paopao-ce/internal/model"
)
const (
SearchTypeDefault SearchType = "search"
SearchTypeTag SearchType = "tag"
)
type SearchType string
type QueryReq struct {
Query string
Visibility []model.PostVisibleT
Type SearchType
}
type QueryResp struct {
Items []*model.PostFormated
Total int64
}
// TweetSearchService tweet search service interface
type TweetSearchService interface {
VersionInfo
IndexName() string
AddDocuments(documents []map[string]interface{}, primaryKey ...string) (bool, error)
DeleteDocuments(identifiers []string) error
Search(q *QueryReq, offset, limit int) (*QueryResp, error)
}