Autocomplete provides auto-complete / search-as-you-type functionality. This is a navigational feature to guide users to relevant results as they are typing. Autocomplete makes use of the Elastic Search completion suggester.
Enterprise Search uses the content of relevant document fields to populate document field system_autocomplete. This field yields autocomplete words and phrases that are presented to the user as characters are typed in a search box.
Document fields that contribute to the autocomplete are configured at silo level, by adjusting the silo configuration xml. For example:
<docfields> <list> <item name="doc_title" completionuse="phrase" completionweight="4"/> <item name="doc_keywords" completionuse="phrase" completionweight="3"/> <item name="doc_title" completionuse="words" completionweight="1"/> <item name="doc_body" completionuse="terms" completionweight="2"/> </list> </docfields> <extrafields> <list> <item name="extra_acties_title" datatype="text"/> <item name="extra_trefwoorden_title" datatype="keyword" completionuse="phrase" completionweight="3"/> </list> </extrafields> <completion_thesaurus>KWD</completion_thesaurus>
- Doc fields must be known fields, see Standard fields.
- Attribute completionuse indicates that the field will be used to populate the autocomplete field.
- Value phrase requests to use the entire field content as an autocomplete term. This is suitable for single valued fields such as a title, or multivalued fields such as a keyword field. It is not suitable for fields that contain a substantial amount of text, such as the body field.
- Value terms requests to use a set of completion terms. A completion term can consist of multiple words. A completion term is used as autocomplete term if it occurs in the field content. The set of completion terms is supplied by means of a Smartsite thesaurus. Element completion_thesaurus specifies the code of the thesaurus.
- Value words requests to split the field content on spacing characters, punctuation characters and a number of other characters. Resulting words are used as autocomplete terms.
- Attribute completionweight specifies a weight to be associated with autocomplete terms obtained from the field. This is an integral value. There is no particular upper limit such as 10 or 100. If omitted a default 1 will be used. A higher weight causes the term to appear higher in the list of autocomplete terms the user can select from.
- A field can occur more than once, as doc_title in the example, in order to apply the field more than once. Distinct values for completionuse must be specified in that case.
- Extra fields can be configured to extend the set of standard fields; see Extra fields. An extra field can produce autocomplete terms, as for doc fields.
- System fields cannot produce autocomplete terms.
Elastic Search applies a default if no fields are configured for the autocomplete:
- Field doc_title, completion use words, completion weight 1.