Documentation
¶
Index ¶
- Constants
- func ApplySuggestionsPreferences(requestQuery querytranslate.RSQuery, preferences *Preferences) (isApplied bool)
- func Contains(a []string, x string) bool
- func GenerateDocumentSuggestionsQuery(q querytranslate.Query, value string, ...) (*es7.SearchService, *es7.BoolQuery)
- func Instance() *suggestions
- func SetIndexPreferences(pref IndexPreferences)
- func SetPopularPreferences(pref PopularPreferences)
- func SetRecentPreferences(pref RecentPreferences)
- type CacheSyncScript
- type Error
- func ApplySuggestions(requestQuery querytranslate.RSQuery, originalResponse []byte, ...) ([]byte, *Error)
- func GetDocumentSuggestions(q querytranslate.Query, value string, ...) ([]querytranslate.SuggestionHIT, *Error)
- func GetFAQSuggestions(config querytranslate.FAQSuggestionsOptions, value string, searchboxId *string) ([]querytranslate.SuggestionHIT, *Error)
- func GetPopularSuggestions(config querytranslate.PopularSuggestionsOptions, value string, ...) ([]querytranslate.SuggestionHIT, *Error)
- func GetRecentSuggestions(q querytranslate.Query, config querytranslate.RecentSuggestionsOptions, ...) ([]querytranslate.SuggestionHIT, *Error)
- type ExternalSuggestion
- type IndexPreferences
- type PopularPreferences
- type Preferences
- type RecentPreferences
- type Suggestion
- type SuggestionOutput
- type SuggestionsPreferencesMigration
Constants ¶
const (
NumberOfDays = 30
)
Variables ¶
This section is empty.
Functions ¶
func ApplySuggestionsPreferences ¶
func ApplySuggestionsPreferences(requestQuery querytranslate.RSQuery, preferences *Preferences) (isApplied bool)
func GenerateDocumentSuggestionsQuery ¶
func GenerateDocumentSuggestionsQuery(q querytranslate.Query, value string, config querytranslate.RecentDocumentSuggestionsOptions, userId string, indices []string) (*es7.SearchService, *es7.BoolQuery)
GenerateDocumentSuggestionsQuery will generate the document suggestions query based on the input values and accordingly return the built query
func Instance ¶
func Instance() *suggestions
Use only this function to fetch the instance of suggestions from within this package to avoid creating stateless duplicates of the plugin.
func SetIndexPreferences ¶
func SetIndexPreferences(pref IndexPreferences)
Sets the index preferences
func SetPopularPreferences ¶
func SetPopularPreferences(pref PopularPreferences)
Sets the popular preferences
func SetRecentPreferences ¶
func SetRecentPreferences(pref RecentPreferences)
Sets the recent preferences
Types ¶
type CacheSyncScript ¶
type CacheSyncScript struct {
// contains filtered or unexported fields
}
func (CacheSyncScript) Index ¶
func (s CacheSyncScript) Index() string
func (CacheSyncScript) PluginName ¶
func (s CacheSyncScript) PluginName() string
func (CacheSyncScript) SetCache ¶
func (s CacheSyncScript) SetCache(response *elastic.SearchResult) error
type Error ¶
func ApplySuggestions ¶
func ApplySuggestions( requestQuery querytranslate.RSQuery, originalResponse []byte, recentSuggestionsMap map[string]SuggestionOutput, popularSuggestionsMap map[string]SuggestionOutput, featuredSuggestionsMap map[string]SuggestionOutput, faqSuggestionsMap map[string]SuggestionOutput, documentSuggestionsMap map[string]SuggestionOutput, ) ([]byte, *Error)
func GetDocumentSuggestions ¶
func GetDocumentSuggestions(q querytranslate.Query, value string, config querytranslate.RecentDocumentSuggestionsOptions, userId string, indices []string) ([]querytranslate.SuggestionHIT, *Error)
GetDocumentSuggestions will get the document suggestions based on the current user.
func GetFAQSuggestions ¶
func GetFAQSuggestions(config querytranslate.FAQSuggestionsOptions, value string, searchboxId *string) ([]querytranslate.SuggestionHIT, *Error)
GetFAQSuggestions will return the FAQ suggestions based on the passed value
func GetPopularSuggestions ¶
func GetPopularSuggestions(config querytranslate.PopularSuggestionsOptions, value string, indices []string) ([]querytranslate.SuggestionHIT, *Error)
To get popular suggestions
func GetRecentSuggestions ¶
func GetRecentSuggestions(q querytranslate.Query, config querytranslate.RecentSuggestionsOptions, indices []string) ([]querytranslate.SuggestionHIT, *Error)
To get recent suggestions
type ExternalSuggestion ¶
type ExternalSuggestion struct {
Key string `json:"key"`
Count *int64 `json:"count"`
Indices []string `json:"indices"`
Meta map[string]interface{} `json:"meta,omitempty"`
CustomEvents map[string][]interface{} `json:"customEvents,omitempty"`
}
Custom external suggestions
type IndexPreferences ¶
type IndexPreferences struct {
Indices []string `json:"indices"`
ShowDistinctSuggestions *bool `json:"showDistinctSuggestions"`
EnablePredictiveSuggestions *bool `json:"enablePredictiveSuggestions"`
MaxPredictedWords *int `json:"maxPredictedWords"`
Size *int `json:"size"`
ApplyStopwords *bool `json:"applyStopwords"`
CustomStopwords []string `json:"customStopwords"`
EnableSynonyms *bool `json:"enableSynonyms"`
IncludeFields []string `json:"includeFields"`
ExcludeFields []string `json:"excludeFields"`
CategoryField *string `json:"categoryField"`
URLField *string `json:"urlField"`
CustomQuery *string `json:"customQuery"`
}
preferences for index type of suggestions
type PopularPreferences ¶
type PopularPreferences struct {
Size int `json:"size"`
MinCount int64 `json:"minCount"`
MinChars int64 `json:"minChars"`
MinHits int64 `json:"minHits"`
NumberOfDays int64 `json:"numberOfDays"`
Blacklist []string `json:"blacklist"`
Indices []string `json:"indices"`
ExternalSuggestions []ExternalSuggestion `json:"externalSuggestions"`
TransformDiacritics bool `json:"transformDiacritics"`
LastSyncTime int64 `json:"lastSyncedTime"`
AliasToIndex string `json:"aliasToIndex"`
}
preferences for popular type of suggestions
func GetPopularPreferences ¶
func GetPopularPreferences() PopularPreferences
To get the popular preferences
type Preferences ¶
type Preferences struct {
Index IndexPreferences `json:"index"`
Popular PopularPreferences `json:"popular"`
Recent RecentPreferences `json:"recent"`
}
type RecentPreferences ¶
type RecentPreferences struct {
Indices []string `json:"indices"`
MinHits *int `json:"minHits"`
MinChars *int `json:"minChars"`
Size *int `json:"size"`
}
preferences for recent type of suggestions
func GetRecentPreferences ¶
func GetRecentPreferences() RecentPreferences
To get the recent preferences
type Suggestion ¶
type Suggestion struct {
ID string `json:"id"`
Key string `json:"key"`
Count *int64 `json:"count"`
Indices []string `json:"indices"`
Meta map[string]interface{} `json:"meta,omitempty"`
QueryLength *int `json:"search_characters_length,omitempty"`
CustomEvents map[string][]interface{} `json:"customEvents,omitempty"`
}
type SuggestionOutput ¶
type SuggestionOutput struct {
QueryID string
Suggestions []querytranslate.SuggestionHIT
Error *Error
}
type SuggestionsPreferencesMigration ¶
type SuggestionsPreferencesMigration struct {
// contains filtered or unexported fields
}
func (SuggestionsPreferencesMigration) ConditionCheck ¶
func (m SuggestionsPreferencesMigration) ConditionCheck() (bool, *util.Error)
func (SuggestionsPreferencesMigration) IsAsync ¶
func (m SuggestionsPreferencesMigration) IsAsync() bool
func (SuggestionsPreferencesMigration) Script ¶
func (m SuggestionsPreferencesMigration) Script() *util.Error