It is possible to implement a custom search filter (search input component) in your WebHelp Responsive output. The search input component is where users enter search queries to locate certain content within the WebHelp output.
/**
* Object that implements the methods required by WebHelp to run a search filter.
*/
function CustomSearchFilter() {
/**
* Method required to run the search filter in webhelp. It is called when the users
* executes the query in the search page.
*
* @param {WebHelpAPI.SearchResult} searchResult The search result for the executed query.
*
* @return A list of WebHelpAPI.SearchResult objects
*/
this.filterResults = function (searchResult) {
// implement filter
return filteredResults;
}
}
// Set the Search Filter to WebHelp
WebHelpAPI.setCustomSearchFilter(new CustomSearchFilter());
...
WebHelpAPI.SearchResult object.<div>
<script src="${oxygen-webhelp-template-dir}/js/search-filter.js"></script>
</div>
<resources> section (see Template
Resources for more details):
<fileset>
<include name="js/**"/>
</fileset>
<webhelp> element:
<html-fragments>
<fragment file="fragments/search-filter-script-fragment.xml"
placeholder="webhelp.fragment.head.search.page"/>
</html-fragments>