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
701 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 DocItems []map[string]interface{}
// TweetSearchService tweet search service interface
type TweetSearchService interface {
IndexName() string
AddDocuments(documents DocItems, primaryKey ...string) (bool, error)
DeleteDocuments(identifiers []string) error
Search(user *model.User, q *QueryReq, offset, limit int) (*QueryResp, error)
}