Bug 365258 - [Search]Add sort by name option in the search result page. 
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/searchExplorer.js b/bundles/org.eclipse.orion.client.core/web/orion/searchExplorer.js
index 6303006..ca919ee 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/searchExplorer.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/searchExplorer.js
@@ -128,6 +128,7 @@
 				this.useFlatList= JSON.parse(useFlatList);
 			} 
 		}
+		this.sortByName = (this.queryObj.sort.indexOf("Name") > -1);
 	},
 	
 	SearchResultModel.prototype.restoreLocationStatus = function() {
@@ -925,6 +926,14 @@
 				that.switchTo(!checked);
 			}
 		}));
+		
+		newMenu.addChild(new dijit.CheckedMenuItem({
+			label: "Sort by Name",
+			checked: that.model.sortByName,
+			onChange : function(checked) {
+				that.sortWithName(checked);
+			}
+		}));
 		var menuButton = new dijit.form.DropDownButton({
 			label : "Options",
 			dropDown : newMenu
@@ -972,6 +981,18 @@
 		}
 	};
 	
+	SearchResultExplorer.prototype.sortWithName = function(byName) {
+		if(this.model.sortByName === byName){
+			return;
+		}
+		var qParams = mSearchUtils.copyQueryParams(this.model.queryObj);
+		qParams.sort = byName ? "Name asc" : "Path asc";
+		qParams.start = 0;
+		var href =  mSearchUtils.generateSearchHref(qParams);
+		//window.open(href);
+		window.location.href = href;
+	};
+	
 	SearchResultExplorer.prototype.expandAll = function() {
 		var root = this.model.getRealRoot();
 		if(root.isRoot){