       @contents = @collection # Keep a reference to the original collection
 
       @listenTo(searchView, 'search', @filter)
+
+
+      @collection.comparator = SORT_COMPARATOR
+      @collection.sort()
+
+      @listenTo @collection, 'change', () =>
+        if not @sorting
+          @sorting = setTimeout ( () =>
+            @collection.sort()
+            @sorting = false
+            ), SORT_TIMEOUT
+
+      @listenTo @collection, 'sort', () => @reorder()
+
 
     filter: (query) ->
       if not query

  'cs!views/workspace/menu/toolbar-search'
  'hbs!templates/workspace/content/search-results'
], ($, _, Backbone, Marionette, SearchResultsItemView, searchView, searchResultsTemplate) ->

  return class SearchResultsView extends Marionette.CompositeView
    template: searchResultsTemplate

        @collection = new Backbone.Collection(filtered);

      @render()

    # Instead of re-rendering each view when sorting, just update the ordering
    # of the rendered elements in the DOM
    reorder: () ->

      @collection.each (childModel, index) =>
        $containerChildren = @$itemViewContainer.children()

        childView = @children.findByModel(childModel)
        $el = childView.$el
        childIndex = $containerChildren.index($el)

        if index != childIndex
          $el.insertBefore($containerChildren.eq(index))
