🐹 + 🔍
- Update 9/26/17: This code is hella old and was a bit early days in my Ember usage. But proud it helped us get some things done back in those days. :)
The Ember.js framework and Algolia make a pretty slick team for powering a user-friendly search experience.
This small library demonstrates one way to splice Ember and Algolia based on my work on Science Exchange's online marketplace. It's akin to Algolia's own example marketplace project for WordPress plugins. The code assumes a split interface between results and filters, which might look a little something like:
export default Ember.Route.extend({
model: function(params) {
var {
q,
page
} = params;
var options = {
query: q,
page: page,
facetFilters: params.facetFilters,
};
return this.store.adapterFor('algolia').query('model-name', options);
},
setupController: function(controller, model) {
this._super(controller, model);
controller.setProperties({
facets: model.facets,
});
},
});