Im building a MVC4 application to make searches on a wiki document. Everything works great but i have not been able to figure out the best way to make the facets linkable.
i precent the facets on my startpage to make it easier to find keywords you look for:
var products = solr.Query(SolrQuery.All,
new QueryOptions {
Rows = 0,
Facet = new FacetParameters {
Queries = new[] { new SolrFacetFieldQuery("products") }
}
});
foreach(var facet in products.FacetFields["products"]) {
var catagoryFacet = new CategoryFacet(facet.Key, facet.Value);
facetProductList.Add(catagoryFacet);
}
Then i loop through the list in the view like this:
<h2> Products: </h2>
@foreach (var facet in Model)
{
foreach(var item in facet.products) {
<td><a href="http://localhost:5000/Home/FreeSearch?search=@Html.DisplayFor(ModelItem => item.Name)">@Html.DisplayFor(ModelItem => item.Name), @Html.DisplayFor(ModelItem => item.Count)</a></td> <br/>
}
But with this approach, when a user clicks the link what happen is that i send the word of facet back to the controller that fire of a search on that keyword since i know it exist.
I know this is kind of a bad way so i am trying to figure out a better way, and since im from sweden the link is broken if i use any of "åäö". It´s possible to handle by javascript but it feels very ugly, so how can i do this in a better way?
I have been looking at the the filter query but how do i make it linkable?
Regards
Jonathan