Class SuggestServiceProperties
- All Implemented Interfaces:
SuggestConfigProvider
A configuration wrapper around all required settings. All settings can be configured as environment variables or system properties. System properties are always preferred over environment variables.
Only the environment variable names are documented - the System Properties are the same, just in the lowercase form and with dots instead underscores (e.g. instead 'SUGGEST_SERVER_PORT' it is 'suggest.server.port').
-
Constructor Summary
ConstructorsConstructorDescriptionSuggestServiceProperties
(com.typesafe.config.Config config) SuggestServiceProperties
(@NonNull InputStream stream) SuggestServiceProperties
(Properties properties) Deprecated.SuggestServiceProperties
(Properties properties, Function<String, String> getEnvAccess) -
Method Summary
Modifier and TypeMethodDescriptionvoid
foreachDataproviderConfig
(BiConsumer<String, Map<String, Object>> configConsumer) getConfig
(@NonNull String indexName, SuggestConfig modifiableConfig) Retrieve config for a given index.Expects the env var 'SUGGEST_INDEX_FOLDER' to name a index-folder that should be used for lucene to store its data.Prefix for /health and /metrics path.String[]
Expects the env var SUGGEST_PRELOAD_INDEXES as a comma separated list of all index names that should be initialized and loaded on startup.Expects env var 'SUGGEST_SERVER_ADDRESS' set to a valid server address.int
Expects env var 'SUGGEST_SERVER_PORT' set to a valid port number.int
Expects the env var 'SUGGESTER_MAX_IDLE_MINUTES' or the system property 'suggester.max-idle-minutes' to be set to an integer value.int
Expects env var 'SUGGEST_UPDATE_RATE' set to an integer between 5 and 3600.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.cxp.ocs.smartsuggest.spi.SuggestConfigProvider
getPriority
-
Constructor Details
-
SuggestServiceProperties
public SuggestServiceProperties() -
SuggestServiceProperties
public SuggestServiceProperties(com.typesafe.config.Config config) -
SuggestServiceProperties
Deprecated.use constructor withConfig
arg instead.- Parameters:
properties
- to load
-
SuggestServiceProperties
-
SuggestServiceProperties
-
-
Method Details
-
getDefaultSuggestConfig
-
getConfig
Description copied from interface:SuggestConfigProvider
Retrieve config for a given index. In case only some index specific values should be set, the default suggest config can be used since it may contain global settings (if not null).- Specified by:
getConfig
in interfaceSuggestConfigProvider
- Parameters:
indexName
- name of the index that should be configuredmodifiableConfig
- copy of the suggest config that was set as default for the whole service. It can be modified and returned or a different config object can be returned. Returning null is considered equivalent to returning that default config.- Returns:
- suggest configuration
-
foreachDataproviderConfig
-
getServerPort
public int getServerPort()Expects env var 'SUGGEST_SERVER_PORT' set to a valid port number. Defaults to 8081.- Returns:
- server port
-
getServerAdress
Expects env var 'SUGGEST_SERVER_ADDRESS' set to a valid server address. Defaults to "0.0.0.0".- Returns:
- server address
-
getUpdateRateInSeconds
public int getUpdateRateInSeconds()Expects env var 'SUGGEST_UPDATE_RATE' set to an integer between 5 and 3600. It's used as the interval on how often the SuggestDataProviders are asked if they have new data.
search-test-ocssuggest-6b65dd5598-jz7z5Defaults to 60.
- Returns:
- value in seconds
-
getPreloadIndexes
Expects the env var SUGGEST_PRELOAD_INDEXES as a comma separated list of all index names that should be initialized and loaded on startup.- Returns:
- array of indexes to be reloaded
-
getIndexFolder
Expects the env var 'SUGGEST_INDEX_FOLDER' to name a index-folder that should be used for lucene to store its data.
Defaults to a temporary directory with the prefix "ocs_suggest".
- Returns:
- base path for suggester index
-
getSuggesterMaxIdleMinutes
public int getSuggesterMaxIdleMinutes()Expects the env var 'SUGGESTER_MAX_IDLE_MINUTES' or the system property 'suggester.max-idle-minutes' to be set to an integer value. Defaults to 30.
It's used to close suggesters if unused for that specified time. In case a request comes in for that suggester again, it is initialized asynchronously. This means it will be available after a few seconds (depending on the backing suggest-data-providers) after the first request.
- Returns:
- value in minutes
-
getManagementPathPrefix
Prefix for /health and /metrics path. Should start with a slash and end without. Defaults to empty string.- Returns:
- path prefix
-
Config
arg instead.