Documentation ¶
Overview ¶
Package module is the core package of elasthink
Index ¶
- func InitModule(stopwordData entity.StopwordData, redisObject *redis.Redis, ...)
- type CreateIndexRequestPayload
- type KeywordSuggestionResponsePayload
- type Module
- type RankByShowCount
- type Response
- func CreateIndex(ctx context.Context, documentID int64, documentType string, ...) Response
- func Search(ctx context.Context, documentType string, requestPayload SearchRequestPayload) Response
- func SuggestKeywords(ctx context.Context, documentType, prefix string) Response
- func UpdateIndex(ctx context.Context, documentID int64, documentType string, ...) Response
- type SearchRequestPayload
- type SearchResponsePayload
- type UpdateIndexRequestPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitModule ¶
func InitModule(stopwordData entity.StopwordData, redisObject *redis.Redis, stopwordRemovalUsage bool)
InitModule is a function that initializes a module object and its requirements (dependencies)
Types ¶
type CreateIndexRequestPayload ¶
type CreateIndexRequestPayload struct {
DocumentName string `json:"documentName"`
}
CreateIndexRequestPayload is the universal request payload for create index handler
type KeywordSuggestionResponsePayload ¶
type KeywordSuggestionResponsePayload struct {
SortedKeywords []string `json:"sortedKeywords"`
}
KeywordSuggestionResponsePayload is the universal response payload for keyword suggestion API handler
type RankByShowCount ¶
type RankByShowCount []entity.SearchResultRankData
RankByShowCount is the additional struct for document ranking purpose based on its ShowCount
func (RankByShowCount) Len ¶
func (r RankByShowCount) Len() int
func (RankByShowCount) Less ¶
func (r RankByShowCount) Less(i, j int) bool
func (RankByShowCount) Swap ¶
func (r RankByShowCount) Swap(i, j int)
type Response ¶
Response is the universal response struct for all API
func CreateIndex ¶
func CreateIndex(ctx context.Context, documentID int64, documentType string, requestPayload CreateIndexRequestPayload) Response
CreateIndex is the core function to create an index of a document
func Search ¶
func Search(ctx context.Context, documentType string, requestPayload SearchRequestPayload) Response
Search is the core function of searching a document
func SuggestKeywords ¶
SuggestKeywords is the core function for keyword suggestion (by document type and prefix)
func UpdateIndex ¶
func UpdateIndex(ctx context.Context, documentID int64, documentType string, requestPayload UpdateIndexRequestPayload) Response
UpdateIndex is the core function to update the index of a document. This requires old document name and new document name
type SearchRequestPayload ¶
type SearchRequestPayload struct {
SearchTerm string `json:"searchTerm"`
}
SearchRequestPayload is the universal request payload for search handlers
type SearchResponsePayload ¶
type SearchResponsePayload struct {
RankedResultList []entity.SearchResultRankData `json:"rankedResultList"`
}
SearchResponsePayload is the universal response payload for search handlers
type UpdateIndexRequestPayload ¶
type UpdateIndexRequestPayload struct { OldDocumentName string `json:"oldDocumentName"` NewDocumentName string `json:"newDocumentName"` }
UpdateIndexRequestPayload is the universal request payload for update index handler