Configuring auto-completion

Description

Search result templates provided by Funnelback contains simple auto-completion configuration that can be managed using results page configuration parameters.

Default settings of the datasets block returns up to 10 simple suggestions from the results page after typing minimum three characters into form field.

simple.ftl

<#if question.collection.configuration.value('auto-completion') == 'enabled'>
jQuery('input.query').autocompletion({
  datasets: {
   <#if question.collection.configuration.valueAsBoolean('auto-completion.standard.enabled')>
   organic: {
     collection: '${question.collection.id}',
     profile : '${question.profile}',
     program: '<@s.cfg>auto-completion.program</@s.cfg>',
     format: '<@s.cfg>auto-completion.format</@s.cfg>',
     alpha: '<@s.cfg>auto-completion.alpha</@s.cfg>',
     show: '<@s.cfg>auto-completion.show</@s.cfg>',
     sort: '<@s.cfg>auto-completion.sort</@s.cfg>'
     group: true,
   }
   </#if>
  },
  length: '<@s.cfg>auto-completion.length</@s.cfg>'
 });
 </#if>

Default values - results page options

auto-completion.alpha=.5
auto-completion=enabled
auto-completion.format=extended
auto-completion.length=3
auto-completion.program=suggest.json
auto-completion.show=10
auto-completion.sort=0
auto-completion.source.extra=
auto-completion.source=internal
auto-completion.standard.enabled=true

Examples

auto-completion.length=1