Class SuggestConfig
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
If suggestions are grouped by a certain value of their payload (e.g.static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
boolean
int
int
boolean
boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGroupConfig
(String groupName, int limit) Add a group config with the specified name and limit to the end of the ordered list.clone()
boolean
If set to false, the indexation of the received data will be done sequentially.void
setAlwaysDoFuzzy
(boolean alwaysDoFuzzy) By default fuzzy searches are only done, if there are no exact matches within primary or secondary text.void
setGroupConfig
(List<SuggestConfig.GroupConfig> groupConfig) Defines in which order the suggestion groups should be returned and how they should be limited.void
setGroupDeduplicationOrder
(String[] groupDeduplicationOrder) Defines in which order similar suggestions from different "groups" are preferred.void
setGroupKey
(String groupKey) In case several data-sources are used, each data-source is requested for the same amount of suggestions.void
Set locale for string transformation and sorting.void
setMaxSharpenedQueries
(int maxSharpenedQueries) Defines the limit of returned sharpened queries.void
setPrefetchLimitFactor
(int prefetchLimitFactor) If grouping and limiting is configured by a key that comes from a single or merged data-provider, then this value can be used to increase the internal amount of fetched suggestions.void
setSortOrder
(SuggestConfig.SortStrategy sortStrategy) Defines how matching suggest terms are ordered in the result.void
setUseDataSourceMerger
(boolean useDataSourceMerge) If several suggest-data-providers are used, they are indexed into separate indexes by default.void
setUseRelativeShareLimit
(boolean useRelativeShareLimit) Defines to use the limits of the group-configs as relative share values, e.g.
-
Field Details
-
locale
-
alwaysDoFuzzy
public boolean alwaysDoFuzzy -
useDataSourceMerger
public boolean useDataSourceMerger -
groupKey
-
groupDeduplicationOrder
-
prefetchLimitFactor
public int prefetchLimitFactor -
maxSharpenedQueries
public int maxSharpenedQueries -
groupConfig
-
isIndexConcurrently
public boolean isIndexConcurrently
-
-
Constructor Details
-
SuggestConfig
public SuggestConfig()
-
-
Method Details
-
setLocale
Set locale for string transformation and sorting.- Parameters:
locale
- locale
-
setUseDataSourceMerger
public void setUseDataSourceMerger(boolean useDataSourceMerge) If several suggest-data-providers are used, they are indexed into separate indexes by default. This option activates a merging logic, so that all provided data is merged into one index.
This could reduce load and improve performance since a single Lucene suggester is asked for results. However in such a case the weights should be in a similar range to avoid a proper ranking.
Default: false- Parameters:
useDataSourceMerge
-
-
setAlwaysDoFuzzy
public void setAlwaysDoFuzzy(boolean alwaysDoFuzzy) By default fuzzy searches are only done, if there are no exact matches within primary or secondary text. If this flag is set, fuzzy search is also done if result size is below limit.- Parameters:
alwaysDoFuzzy
- true to activate
-
setSortOrder
Defines how matching suggest terms are ordered in the result.- Parameters:
sortStrategy
- sortStrategy
-
setGroupKey
In case several data-sources are used, each data-source is requested for the same amount of suggestions. Per default all those suggestions are simply appended and truncated to get the final list of suggestions.
With this setting it is possible to specify a key that is available in the payload of all provided suggestions. The final result list will then be grouped by this payload-value and truncated according to the provided group configs.
It's recommended to setGroupConfig as well, otherwise the default limiter will be used after grouping.
- Parameters:
groupKey
- groupKey
-
addGroupConfig
Add a group config with the specified name and limit to the end of the ordered list.
Use the groupName CommonPayloadFields.PAYLOAD_TYPE_OTHER = 'other' to specify a default limit value.
- Parameters:
groupName
- groupNamelimit
- limit
-
setGroupDeduplicationOrder
Defines in which order similar suggestions from different "groups" are preferred. Names that appear first are preferred over names appearing later.
This setting is 'null' per default, which means no deduplication is done at all. If an empty String[] is set, deduplication is done randomly.
This only works, if the suggest service is configured with a grouping key.
- Parameters:
groupDeduplicationOrder
- ordered array, suggest entries from groups at beginning are preferred
-
setGroupConfig
Defines in which order the suggestion groups should be returned and how they should be limited.- If 'useRelativeShareLimit' is 'false', these limits are considered absolute.
- If 'useRelativeShareLimit' is 'true', the limits are normalized into according relative values, e.g. 1, 2 and 2 becomes 20%, 40% and 40%
This only works, if the suggest service is configured with a grouping key.
- Parameters:
groupConfig
- full groupConfig
-
setMaxSharpenedQueries
public void setMaxSharpenedQueries(int maxSharpenedQueries) Defines the limit of returned sharpened queries.Sharpened queries are queries that are injected directly (without requesting a Lucene index) from a hash-map if the input query matches one of the existing entries.
This limit only is considered if there are more sharpened queries than defined by that limit.
- Parameters:
maxSharpenedQueries
-
-
setPrefetchLimitFactor
public void setPrefetchLimitFactor(int prefetchLimitFactor) If grouping and limiting is configured by a key that comes from a single or merged data-provider, then this value can be used to increase the internal amount of fetched suggestions. This is usable to increase the likeliness to get the desired group counts.
Default: 1 -
isIndexConcurrently
public boolean isIndexConcurrently()If set to false, the indexation of the received data will be done sequentially. This means it will take longer until the service is ready for usage and will spare computational power that might be used for others.- Returns:
-
clone
-