Skip to content

Commit

Permalink
Allow front-end to perform searches.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshVarty committed Dec 7, 2014
1 parent bf67617 commit 98b13d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/SourceBrowser.Site/Controllers/SearchController.cs
Expand Up @@ -14,10 +14,11 @@ public ActionResult Index()
return View();
}

public ActionResult Repository(string username, string repo, string query)
public ActionResult Repository(string username, string repository, string query)
{
var placeHolder =Json("test");
return placeHolder;
var results = Search.SearchIndex.SearchRepository(username, repository, query);
var json = Json(results);
return json;
}
}
}
12 changes: 8 additions & 4 deletions src/SourceBrowser.Site/Scripts/search.js
Expand Up @@ -10,8 +10,10 @@
}
else if (splitPath.length >= 2)
{
var username = splitPath[0];
var repository = splitPath[1];
var username = splitPath[1];
console.log(username);
var repository = splitPath[2];
console.log(repository);
searchRepository(username, repository, query);
}
console.log(splitPath.length);
Expand All @@ -30,9 +32,11 @@ function searchRepository(username, repository, query) {
});

$.ajax({
type: "POST",
type: "GET",
url: "/Search/Repository/",
data: data,
//TODO: If anyone knows a better way to do this, please share it.
//My Javascript is not strong...
data: "username=" + username + "&repository=" + repository + "&query="+ query,
success: results
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/SourceBrowser.Site/SourceBrowser.Site.csproj
Expand Up @@ -424,6 +424,10 @@
<Project>{c91050bd-5010-4ebd-a6ae-52cca7c2553d}</Project>
<Name>SourceBrowser.Generator</Name>
</ProjectReference>
<ProjectReference Include="..\SourceBrowser.Search\SourceBrowser.Search.csproj">
<Project>{6c2ed4c0-e609-47d8-aa05-1cacbe5252ac}</Project>
<Name>SourceBrowser.Search</Name>
</ProjectReference>
<ProjectReference Include="..\SourceBrowser.SolutionRetriever\SourceBrowser.SolutionRetriever.csproj">
<Project>{f90b7983-d137-4c89-b668-a6082be39303}</Project>
<Name>SourceBrowser.SolutionRetriever</Name>
Expand Down

0 comments on commit 98b13d1

Please sign in to comment.