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

37 lines
723 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
}
type TsDocItem struct {
Post *model.Post
Content string
}
// TweetSearchService tweet search service interface
type TweetSearchService interface {
IndexName() string
AddDocuments(data []TsDocItem, primaryKey ...string) (bool, error)
DeleteDocuments(identifiers []string) error
Search(user *model.User, q *QueryReq, offset, limit int) (*QueryResp, error)
}