/**
 * Search controller to handle search
 * 
 */
define([ 'jquery', 
         'underscore', 
         'backbone', 
         'marionette',
         'apps/search/entities/searchEntities'], 
         function($, _,Backbone, Marionette, SearchEntities) {

	var SearchAppController = Backbone.Marionette.Controller.extend({
		initialize : function(options) {
			this.searchEntities = new SearchEntities();
		},

		/**
		 * Search end point to call search from the controller.
		 */
		search : function(data) {
			var defer = $.Deferred();
			var searchCall = this.searchEntities.search(data);

			$.when(searchCall).done(function(jsonRes) {
				defer.resolve(jsonRes);
			}).fail(function() {
				defer.reject();
			});
			
			return defer.promise();
		},
		
		getDocById: function(docId){
            var defer = $.Deferred();
            var call = this.searchEntities.getDocById(docId);

            $.when(call).done(function(jsonRes) {
                defer.resolve(jsonRes);
            }).fail(function() {
                defer.reject();
            });
            
            return defer.promise();
        },
	});

	return SearchAppController;
});
@@ -745,21 +745,25 @@
 );%0A%09%09%7D,%0A
-%09%09%0A%09%09
+%0A        
 getDocBy
@@ -781,16 +781,17 @@
 n(docId)
+ 
 %7B%0A      
@@ -1056,28 +1056,16 @@
     %7D);%0A
-            
 %0A       
@@ -1104,16 +1104,17 @@
      %7D,%0A
+%0A
 %09%7D);%0A%0A%09r

clean up