Note that there are some explanatory texts on larger screens.

plurals
  1. PORavenDB faceted search and creating breadcrumbs/filter urls in mvc3
    primarykey
    data
    text
    <p>I am using mvc3 and RavenDB. I have a filter menu where users can narrow their search using faceted search, as described here: <a href="http://ravendb.net/docs/client-api/advanced/faceted-search" rel="nofollow">http://ravendb.net/docs/client-api/advanced/faceted-search</a></p> <p>I like to have this URL pattern: <code>/filter/{manufacturer}/{resolution}/{zoom}</code> For example: <code>/filter/canon/6</code> means list all camera's of manufacturer canon with a megapixel of 6 (and all zoom ranges).</p> <p>I have this working but I run into trouble generating URLs. This will only work if the facet values are safe to use in a URL eg. replace all ampersands, spaces etc with a dash and lower case everything. This means I end up with 'ugly' names in my filtermenu links and breadcrumbs. </p> <p><strong>Is there a way to have a friendly name to display to the user for a facet value?</strong> so I can create urls like this:</p> <pre><code>&lt;a href="/filter/canon/"&gt;Canon USA (12)&lt;/a&gt; &lt;a href="/filter/canon/6/"&gt;6 megapixels (5)&lt;/a&gt; </code></pre> <p>One solution I can think of would be to store the filters as documents and just search for a facet value to retrieve its displayname. </p> <p>A filter document can look like this:</p> <pre><code>var filter = new Filter { DisplayName = "Manufacturer" , Slug = "manufacturer" , Items = new List&lt; FilterItem &gt; { new FilterItem() { DisplayName = "Canon USA" , Slug = "canon" } , new FilterItem() { DisplayName = "Photo's &amp; more" , Slug = "photos-and-more" } } } ; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload