Best practice for live searching data store

I’m looking for clarification on whether this is the right way to go about searching.

Search page:

{{input valueBinding="query"}}
{{#each model}}
  {{partial 'searchResult'}}

Search controller:

  query: ''

  runQuery: ->
      .find 'things', query: @get 'query'
      .then (records) =>
        @set 'model', records

  queryObserver: (-> @, @runQuery, 300
  ).observes 'query'

The above produces the desired behaviour - and although ember js prefers convention over configuration it feels like there is still a lot of ways to do the same thing.

Appreciate any thoughts.

I think a good rule of thumb is that any time the state of your application changes, it should be handled by the router. In your case, if the user hits refresh, then you’re losing the state of the search.

With the ever-to-be-coming query-params feature, this will be fairly trivial

In the meantime, there’s a few other things you can do. For example, you could serialize the query into a normal URL segment…that could looks something like this: {
  this.route('Search', {path: '/:query'});

App.SearchRoute = Ember.Route.extend({
  actions: {
    runQuery: function(query) {
      this.transitionTo('search','things', {query: query}));
  model: function(params) {
    return'things', {query: params.query});

App.SearchController = Ember.ArrayController.extend({
  query: Em.computed.oneWay('model.query.query'),
  queryObserver: function() {, 'send', 'runQuery', this.get('query'));