Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Algolia backend search with Algolia Search Helper library for Angular.js

const customSearchClient = {
  search(requests, cb) {
    return fetch('https://algolia-backend-search.herokuapp.com/search', {
      method: 'post',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ requests }),
    }).then(function(res){return res.json()}).then(cb)
  }
};

var alSH = angular.module('AlgoliaSearchHelper', ['ngSanitize']);

// Expose the helper
alSH.factory('helper', function() {
  return algoliasearchHelper(customSearchClient, index, {
    disjunctiveFacets: ['category'],
    hitsPerPage: 7,
    maxValuesPerFacet: 3
  });
});
 
PREVIOUS NEXT
Tagged: #Algolia #backend #search #Algolia #Search #Helper #library
ADD COMMENT
Topic
Name
3+9 =