Inspired by Thomas Tregner's great post about how to use version filters, I've been trying these out in my project (filtering by user role instead of version number, but I'll refer to version here for simplicity).
One concern though was that searches would still return all the content, even topics that may not be relevant to this particular version, and that with the filtering operational, users may even not be able to see the keywords they searched for. Alternatively, we may want to hide content from the search results for some other unspecified reason. This can be addressed at a topic level with MadCap's Search Filters, but how can these by leveraged alongside the version filter so you don't have to select from a drop-down menu twice (once for filtering the page and once for )?
The answer:
- Add concepts to each topic to indicate the features/version/some dimension they are relevant for. Only topics with a concept that is included in the eventual filter will be shown in the search results.
- Create Search Filter Sets for each version, using the same text as each option's "value" attribute for the version filtering. Add all the relevant concepts.
- Add the Search Filter Set to your target.
- Add this jquery code to your version filtering script so that when a different version is selected, the search filter is also updated.
This is at the end of the ShowHideVersion() function in Thomas' code. I'm implementing the version filtering slightly differently, but I guess this should be around the right context.
Code: Select all
$(".search-filter", $(".search-bar-container")).data('filter', e.options[e.selectedIndex].value)
Code: Select all
$(".search-filter", $(".search-bar-container")).data('filter')Code: Select all
.search-filter-wrapper {
width: 0;
border: none;
}