Documentation
¶
Index ¶
- Variables
- func GetSearchRelevancySettingsFromCache() map[string]SearchRelevancyStruct
- func RemoveFromSearchRelevancyCache(index string)
- func SetSearchRelevancySettingsCache(settings map[string]SearchRelevancyStruct)
- func UpdateSearchRelevancyCache(index string, setting SearchRelevancyStruct)
- type AggregationStruct
- type CacheSyncScript
- type IndexSettingStruct
- type LanguageStruct
- type NgramSettings
- type ResultStruct
- type RulesStruct
- type SearchRelevancy
- func (a *SearchRelevancy) AlternateRoutes() []plugins.Route
- func (a *SearchRelevancy) ESMiddleware() []middleware.Middleware
- func (a *SearchRelevancy) InitFunc() error
- func (a *SearchRelevancy) Name() string
- func (a *SearchRelevancy) RSMiddleware() []middleware.Middleware
- func (a *SearchRelevancy) Routes() []plugins.Route
- type SearchRelevancyStruct
- type SearchStruct
- type SortOption
- type SynonymsStruct
Constants ¶
This section is empty.
Variables ¶
var SearchRelevancyCacheMutex = sync.RWMutex{}
SearchRelevancyCacheMutex to handle concurrent map writes
var SearchRelevancySettingsCache = map[string]SearchRelevancyStruct{}
SearchRelevancySettingsCache variable to cache settings
Functions ¶
func GetSearchRelevancySettingsFromCache ¶
func GetSearchRelevancySettingsFromCache() map[string]SearchRelevancyStruct
GetSearchRelevancySettingsFromCache to get all settings from cache
func RemoveFromSearchRelevancyCache ¶
func RemoveFromSearchRelevancyCache(index string)
RemoveFromSearchRelevancyCache function to remove from cache
func SetSearchRelevancySettingsCache ¶
func SetSearchRelevancySettingsCache(settings map[string]SearchRelevancyStruct)
SetSearchRelevancySettingsCache to set all settings in cache
func UpdateSearchRelevancyCache ¶
func UpdateSearchRelevancyCache(index string, setting SearchRelevancyStruct)
UpdateSearchRelevancyCache to update existing setting or add new setting
Types ¶
type AggregationStruct ¶
type AggregationStruct struct {
DataField map[string]string `json:"dataField"`
Size int `json:"size" validate:"gte=0,lte=1000"`
SortBy *querytranslate.SortBy `json:"sortBy"`
IncludeNullValues bool `json:"includeNullValues"`
QueryFormat *string `json:"queryFormat"`
}
AggregationStruct aggregation settings struct
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 IndexSettingStruct ¶
type IndexSettingStruct struct {
EnableNgram bool `json:"enableNgram,omitempty"`
EnableAutosuggestion bool `json:"enableAutoSuggestion,omitempty"`
NgramSettings NgramSettings `json:"ngramSettings,omitempty"`
AutosuggestionSettings NgramSettings `json:"autosuggestionSettings,omitempty"`
}
IndexSettingStruct to store index related settings
type LanguageStruct ¶
type LanguageStruct struct {
Language string `json:"language"`
ApplyStopwords bool `json:"applyStopwords"`
CustomStopwords []string `json:"customStopwords"`
StemmingExceptions []string `json:"stemmingExceptions"`
NormalizeDiacritics bool `json:"normalizeDiacritics"`
}
LanguageStruct language settings struct
type NgramSettings ¶
type ResultStruct ¶
type ResultStruct struct {
Size int `json:"size" validate:"gte=0,lte=1000"`
IncludeFields []string `json:"includeFields"`
ExcludeFields []string `json:"excludeFields"`
Highlight bool `json:"highlight"`
HighlightFields []string `json:"highlightFields"`
HighlightOptions map[string]interface{} `json:"highlightOptions"`
SortOptions []SortOption `json:"sortOptions,omitempty"`
}
ResultStruct result settings struct
type RulesStruct ¶
type RulesStruct struct {
Enabled bool `json:"enabled"`
}
RulesStruct to identify if rules are query enabled or not
type SearchRelevancy ¶
type SearchRelevancy struct {
// contains filtered or unexported fields
}
SearchRelevancy plugin saves default settings for search, aggregations, result, language.
func Instance ¶
func Instance() *SearchRelevancy
Instance returns the singleton instace of SearchRelevancy plugin. Note: Only this function must be used (both within and outside the package) to obtain the instance searchRelevancySettings in order to avoid stateless instances of the plugin.
func (*SearchRelevancy) AlternateRoutes ¶
func (a *SearchRelevancy) AlternateRoutes() []plugins.Route
Expose plugin specific routes
func (*SearchRelevancy) ESMiddleware ¶
func (a *SearchRelevancy) ESMiddleware() []middleware.Middleware
ESMiddleware ES middlewares
func (*SearchRelevancy) InitFunc ¶
func (a *SearchRelevancy) InitFunc() error
InitFunc is a part of Plugin interface that gets executed only once, and initializes the dao, i.e. elasticsearch before the plugin is operational.
func (*SearchRelevancy) Name ¶
func (a *SearchRelevancy) Name() string
Name is a part of Plugin interface that returns the name of the plugin: '[searchsetttings]'.
func (*SearchRelevancy) RSMiddleware ¶
func (a *SearchRelevancy) RSMiddleware() []middleware.Middleware
RSMiddleware RS middlewares
func (*SearchRelevancy) Routes ¶
func (a *SearchRelevancy) Routes() []plugins.Route
Routes returns the searchrelevancy routes that the plugin serves.
type SearchRelevancyStruct ¶
type SearchRelevancyStruct struct {
Search *SearchStruct `json:"search"`
Aggregations *AggregationStruct `json:"aggregations"`
Results *ResultStruct `json:"results"`
Language *LanguageStruct `json:"language"`
Synonyms *SynonymsStruct `json:"synonyms"`
Rules *RulesStruct `json:"rules"`
IndexSettings *IndexSettingStruct `json:"indexSettings"`
}
SearchRelevancyStruct struct for settings request
func GetSearchRelevancySettingFromCache ¶
func GetSearchRelevancySettingFromCache(indexName string) (SearchRelevancyStruct, error)
GetSearchRelevancySettingFromCache to get a setting from cache
type SearchStruct ¶
type SearchStruct struct {
DataField []string `json:"dataField"`
FieldWeights []interface{} `json:"fieldWeights"` // allow string array with single decimal place value to fix [mapper [search.fieldWeights] cannot be changed from type [float] to [long] [type=illegal_argument_exception]] eg. "1.0"
SearchOperators bool `json:"searchOperators"`
QueryString bool `json:"queryString"`
Fuzziness interface{} `json:"fuzziness,omitempty"` // string or int
QueryFormat *string `json:"queryFormat"`
RankFeature *map[string]querytranslate.RankFunction `json:"rankFeature,omitempty"`
DistinctField string `json:"distinctField,omitempty"`
}
SearchStruct search settings struct
type SortOption ¶
type SynonymsStruct ¶
type SynonymsStruct struct {
Enabled bool `json:"enabled"`
}
SynonymsStruct synonym settings struct