Class QuerySuggestManager.QuerySuggestManagerBuilder

java.lang.Object
de.cxp.ocs.smartsuggest.QuerySuggestManager.QuerySuggestManagerBuilder
Enclosing class:
QuerySuggestManager

public static class QuerySuggestManager.QuerySuggestManagerBuilder extends Object
This builder should be used to set up the QuerySuggestManager
  • Constructor Details

    • QuerySuggestManagerBuilder

      public QuerySuggestManagerBuilder()
  • Method Details

    • indexFolder

      public QuerySuggestManager.QuerySuggestManagerBuilder indexFolder(Path indexFolder)
      Sets the root path where the indices for the different tenants will be stored. Required for LUCENE engine.
      Parameters:
      indexFolder - the root path where the indices for the different tenants will be stored.
      Returns:
      the changed builder
    • updateRate

      public QuerySuggestManager.QuerySuggestManagerBuilder updateRate(int seconds)
      Set the rate (in seconds) at which the update should run. The value must be 5 <= x <= 3600. Default: 60
      Parameters:
      seconds - positive integer
      Returns:
      the changed builder
    • engine

      Deprecated.
      only Lucene suggester implemented at the moment
      Deprecated! Only Lucene suggester implemented at the moment!
      Parameters:
      engine - engine to use
      Returns:
      fluid builder
    • addDataProviderConfig

      public QuerySuggestManager.QuerySuggestManagerBuilder addDataProviderConfig(String canonicalClassName, Map<String,Object> config)
      Add configuration for a specific data provider that will be loaded by your environment. It is only applied, if the according data provider is loaded.
      Parameters:
      canonicalClassName - class name of all data provider instances that should receive this config.
      config - the configuration
      Returns:
      fluid builder
    • addDataProviderConfig

      public QuerySuggestManager.QuerySuggestManagerBuilder addDataProviderConfig(Class<? extends SuggestDataProvider> sdpClazz, Map<String,Object> config)
      Same as QuerySuggestManagerBuilder.addDataProviderConfig(String, Map)
      Parameters:
      sdpClazz - class of all data provider instances that should receive this config.
      config -
      Returns:
      the builder itself
    • withLimiter

      public QuerySuggestManager.QuerySuggestManagerBuilder withLimiter(Limiter customLimiter)

      With this method you can specify a default limiter for suggestions from different sources.

      This limiter is only used, if an index uses several data sources but no grouping-key is defined.

      Parameters:
      customLimiter - a limiter implementation
      Returns:
      fluid builder
      See Also:
    • useDataMerger

      Deprecated.
      use SuggestConfigProvider to change this value per index or set defaultSuggestConfig instead.

      Per default for each provided data set, a single suggester is set up. If this flag is enabled, the MergingSuggestDataProvider will be used to merge all provided data for a given index.

      This approach is best suitable in these cases:

      • You want one data source to control the stop-words for all data sources
      • You don't need to filter on "natural tags" AND the "type tag" (only one works at a time)
      • You don't need the fuzzy matches: they don't work with filtering

      Also the data providers should deliver the data with the same locale setting (otherwise only the first locale is picked and a warning is logged).

      Returns:
      fluid builder
      See Also:
    • preloadIndexes

      public QuerySuggestManager.QuerySuggestManagerBuilder preloadIndexes(String... indexNames)
      specify indexes that should be loaded immediately after initialization.
      Parameters:
      indexNames - list of index names to be initialized synchronously when calling 'build()'
      Returns:
      fluid builder
    • addMetricsRegistryAdapter

      Optionally add micrometer.io MeterRegistry. An internal adapter is used in order to avoid ClassNotFound exception in case Micrometer is not on the classpath.
      Parameters:
      reg - adapter with the wanted meter registry
      Returns:
      fluid builder
    • withDefaultSuggestConfig

      public QuerySuggestManager.QuerySuggestManagerBuilder withDefaultSuggestConfig(@NonNull @NonNull SuggestConfig defaultSuggestConfig)
      Add default suggest config that should be used in case no SuggestConfigProvider exists or no provider has a config for a certain index. This config is also forwarded to the suggest config providers in case they only overwrite specific values.
      Parameters:
      defaultSuggestConfig - default suggest config object
      Returns:
      fluid builder
    • withSuggestDataProvider

      public QuerySuggestManager.QuerySuggestManagerBuilder withSuggestDataProvider(SuggestDataProvider additionalSuggestDataProvider)

      Add a custom SuggestDataProvider. Several instances of the same class can be added.

      If the same class is also available via ServiceLoader it is loaded once more!

      In case a DataProviderConfig (Map) is set, it will be passed to all instances of the according class.

      Parameters:
      additionalSuggestDataProvider -
      Returns:
    • build

      public QuerySuggestManager build()
      Build QuerySuggestManager that can manage multiple query suggesters.
      Returns:
      the manager