AdvancedSearch Autocomplete - Technical Doc

The AdvancedSearch.widget.js, during init, calls the GetAutocompleteAdvancedFields servlet to retrieve the fields on which autocomplete must be enabled.

The GetAutocompleteAdvancedFields servlet simply returns the json defined in the /opt/datafari/tomcat/conf/advanced-search.properties. See this doc for more details: https://datafari.atlassian.net/wiki/spaces/DATAFARI/pages/482148378

The returned json is stored by the AdvancedSearch.widget.js in the parameter 'autocompleteFields'

When the AdvancedSearch.widget.js constructs the selected fields thanks to the AjaxFranceLabs.AdvancedSearchField constructor, if the field name is referenced in the 'autocompleteFields' parameter, then the Solr suggester to use is passed as the 'autocompleteSuggester' parameter

In the AdvancedSearchField.js, on the call of the buildTextFieldFilterUI method, if the 'autocompleteSuggester' parameter is set, then an AjaxFranceLabs.AdvancedAutocompleteModule is instancied with the autocompleteSuggester passed as the 'servlet' parameter, and the HTML element on which to apply the autocomplete is passed as the 'elm' parameter.

The AdvancedAutocomplete.module.js instantiate a jquery autocomplete module on the 'elm' parameter and override the 'source' method of the jquery module (which is called each time the user press a keyboard key on the 'elm') to call the 'servlet' (Solr suggester) and create the autocomplete list with each suggestion that have results (it checks that the numFound is more than 0)