 
       @listenTo(searchView, 'search', @filter)
 
-
+      # Attach the comparator to `allContent`.
+      # This guarantees new models are added in sorted order
+      # It does **not** guarantee they will remain in sorted order as they change.
+      #
+      # This is done by listening on `change` events in `allContent` below
       @collection.comparator = SORT_COMPARATOR
       @collection.sort()
 
+      # Start a delayed sort on change:
+      #
+      # - In a large workspace sort takes a while and the page becomes unresponsive.
+      # - Many change events are fired when a single title changes
       @listenTo @collection, 'change', () =>
         if not @sorting
           @sorting = setTimeout ( () =>

            @sorting = false
            ), SORT_TIMEOUT

      @listenTo @collection, 'sort', () => @reorder()



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


  # Delay Sorting.
  # When a title is changed multiple `change` events are fired and
  # if the collection is large then calling `allContent.sort()` takes a long time.
  SORT_TIMEOUT = 250 # milliseconds

  # Sorts `allContent` by lastModified, mediaType, and then by title.
  # This is attached to `allContent` when the view is initialized.
  #
  # Reasons for including here instead of on `allContent` directly:
  #
  # - Other implementations of `allContent` would need to copy-pasta this
  # - Other comparators (sort by Title) will probably be added soon
  # - This is the only code that relies on `allContent` being sorted
  #
  # See `Backbone.Collection.comparator`
  SORT_COMPARATOR = (modelA, modelB) ->
    compareAttribute = (name, desc=false) ->
      valueA = modelA.get(name)
