Class: Function service:search.createGeoJSONBloodhound

module:ngeo search namespace~ngeo.search.createGeoJSONBloodhound.Function

new Function()

Provides a function that creates a Bloodhound engine expecting GeoJSON responses from the search web service, which creates ol.Feature objects as suggestions.

Example:

let bloodhound = createGeoJSONBloodhound(
  'http://example.com/fulltextsearch?query=%QUERY',
  aFilterFunction,
  ol.proj.get('EPSG:3857'));
bloodhound.initialize();

let bloodhound = createGeoJSONBloodhound(
  '',
  undefined,
  ol.proj.get('EPSG:3857'),
  ol.proj.get('EPSG:21781'),
  {
    remote: {
      url: mySearchEngineUrl,
      replace: function(url, query) {
        return url +
            '?qtext=' + encodeURIComponent(query) +
            '&lang=' + gettextCatalog.currentLanguage;
      }
    }
  }
);
bloodhound.initialize();