Configuration

Prior to the configuration and use of the Keyword Suggester you need to set up the following components:

The Keyword Suggester consists of two search components you need to register in your request handler configuration in the solrconfig.xml. You can register the components for any request handler (e.g. add them to your /select handler), but we recommend to set up a dedicated request handler for the Keyword Suggester to avoid conflicts with other query time parameters the Keyword Suggester manipulates during processing.

In the following example the Keyword Suggester components are added as search components and named after their corresponding classes keywordSuggesterPre and keywordSuggesterPost:

<searchComponent name="keywordSuggesterPre" class="de.pixolution.solr.handler.component.KeywordSuggesterPre" >
  <str name="pixolution.parser">pixolutionParser</str>
  <str name="ksuggest.field">keywords</str>
  <str name="ksuggest.analyzer">keywordsAnalyzer</str>
  <str name="ksuggest.max">20</str>
  <str name="ksuggest.threshold">0.2</str>
  <str name="ksuggest.inspect">50</str>  	
</searchComponent>

<searchComponent name="keywordSuggesterPost" class="de.pixolution.solr.handler.component.KeywordSuggesterPost" >
</searchComponent>

pixolution.parser

Mandatory parameter. The PixolutionParser is needed for parsing queries. To retrieve the appropriate parser the name of the PixolutionParserPlugin is required (see PixolutionParserPlugin for the configuration of the parser name).

ksuggest.* params

All other params can be defined at query time. Please read on for the allowed values and details about the ksuggest.field, ksuggest.analyzer, ksuggest.max and ksuggest.threshold parameters. If needed, you can simply override all parameters at query time with different values. This way you can define default values in the solrconfig.xml that you can override at query time.

See this example how to register a dedicated request handler /ksuggest with the necessary components keywordSuggesterPre and keywordSuggesterPost.

<requestHandler name="/ksuggest" class="solr.SearchHandler">
  [...]
  <arr name="first-components">
    <str>keywordSuggesterPre</str>
    <str>pixolutionComponent</str>
  </arr>
  <arr name="last-components">
    <str>keywordSuggesterPost</str>
  </arr>
</requestHandler>

The Keyword Suggester will force a certain order in which the components are executed. The execution order of the components is defined by the first-components and last-components array and needs to be set as shown in the example above. It is important that the keywordSuggesterPre.component is set before the pixolutionComponent within the first-components. The keywordSuggesterPost needs to be called within the last-components.

External image URL cache

To speed up loading external image URLs you can configure a cache described in External image caching