1 Reply · Latest reply on Jan 3, 2018 12:17 PM by Tom Alday

    Explain me the following code?

      (function() {
      data.searchType = $sp.getParameter("t");
      data.results = [];
      data.searchMsg = gs.getMessage("Search");
      data.limit = options.limit || 15;
      var textQuery = '123TEXTQUERY321';
      
      
      if (!input) {
      data.typeaheadTemplates = {};
      
      
      var searchGroupTemplatesGR = new GlideRecord("sp_search_source");
      searchGroupTemplatesGR.query();
      
      
      
      while(searchGroupTemplatesGR.next()) {
      
      if (searchGroupTemplatesGR.getElement("advanced_typeahead_config").getDisplayValue() == "true")
      data.typeaheadTemplates["sp-typeahead-" + searchGroupTemplatesGR.getValue("id") + ".html"] = $sp.translateTemplate(searchGroupTemplatesGR.getValue("typeahead_template"));
      }
      
      
      return;
      }
      
      
      data.q = input.q;
      
      
      return;input.q;
      

      This is a server script in the SP.