Configuring and customizing the type-ahead feature

The type-ahead feature enables users to use a choice-list drop-down as a search field to find and select items in the choice-list. This feature must be configured before it can be used. It can also be customized.

Configuring type-ahead

For instructions on configuring type-ahead, refer to technote 27042315.

Customizing type-ahead

The type-ahead feature has its own index and analyzer that can be customized; following is its default configuration:


    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="256"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>
This configuration enables full-text search behavior like that of the "Find" function of an editor. Suppose, for example, you want to customize type-ahead to ignore articles ("a," "an," "the") and conjunctions ("or," "but," and so on). Specify such words in the file stopwords_en.txt and edit {FTSHOME}\dbset\userdb\Solr\typeahead\conf\schema.xml as follows:

    <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" enablePositionIncrements="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="256"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" enablePositionIncrements="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>
For reference information on all Solr analyzer settings, refer to Apache Solr Wiki .
Note: For reference information about the commands cited in the following procedure, refer to r_cqtsadmin_pl.
If you customized type-ahead before completing full-text search deployment (that is, before executing --setup_cq_fts), no additional step is necessary. If you have already deployed full-text search, complete the following steps:
  1. Stop update mode indexing:
    --stop_update_idx
  2. Restart the FTS WAS profile:
    --stop_fts_was_profile
    --start_fts_was_profile
  3. Regenerate the index:
    --fresh_batch_idx
    (Should this command fail before completion, resume indexing using --run_batch_idx.)
  4. Re-enable the update mode indexer:
    --start_update_idx
  5. Restart the FTS WAS profile:
    --stop_fts_was_profile
    --start_fts_was_profile