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: /wiki/spaces/DATAFARI/pages/482148378
The returned json is stored by the AdvancedSearch.widget.js
in the parameter ‘autocompleteFields’'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’ 'autocompleteFields
' parameter, then the Solr suggester to use is passed as the ‘autocompleteSuggester’ 'autocompleteSuggester
' parameter
In the AdvancedSearchField.js
, on the call of the buildTextFieldFilterUI
method, if the ‘autocompleteSuggester’ 'autocompleteSuggester
' parameter is set, then an AjaxFranceLabs.AdvancedAutocompleteModule
is instancied with the autocompleteSuggester
passed as the ‘servlet’ 'servlet
' parameter, and the HTML element on which to apply the autocomplete is passed as the ‘elm’ 'elm
' parameter.
The AdvancedAutocomplete.module.js
instantiate a jquery autocomplete module on the ‘elm’ 'elm
' parameter and override the ‘source’ 'source
' method of the jquery module (which is called each time the user press a keyboard key on the ‘elm’'elm
') to call the ‘servlet’ 'servlet
' (Solr suggester) and create the autocomplete list with each suggestion that have results (it checks that the numFound
is more than 0)