Implement Suggested Searches

You can edit the home page so that users can use suggested searches. Users can see a list of articles that match the search term or phrase as they type in the search field. Suggestions with exact keywords match in article titles appear at the top of the results, then suggestions that have partial match. You implement suggested searches to provide a faster way for your users to locate and select relevant articles.

The current implementation contains suggested searches by default on both the home page and the results page. If you are using a previous implementation, you can implement suggested searches using the suggestions widget.

Before you implement suggested searches, you must enable attribute level searching for the master identifier (title field) of each content type in the knowledge base. You can find more information about enabling attribute level searching in the About Schema Attribute Options section in Administering Knowledge Advanced .

  1. Edit a Customer Portal page, for example:

    /cp/customer/development/views/pages/home.php

  2. Add the suggested search widget code as follows:

    <rn:widget path="okcs/OkcsSuggestions"/>
  3. Add the suggestion count attribute to specify the number of suggested searches you want to display. The default is 7. The maximum value is 100.

    <rn:widget path="okcs/OkcsSuggestions" suggestion_count="15"/>

Here’s an example of how to include suggested search widget in the home page:

<rn:meta title="#rn:msg:SHP_TITLE_H<>DG#" template="okcs_standard.php" clickstream="home"/>
<div class="rn_Hero">
	<div class="rn_HeroInner">
		<div class="rn_HeroCopy">
			<h1>#rn:msg:WERE_HERE_TO_HELP_LBL#</h1>
		</div>
	<div class="rn_SearchControls">
		<h1 class="rn_ScreenReaderOnly">#rn:msg:SEARCH_CMD#</h1>
		<form method="get" action="/app/results">
			<rn:container source_id="OKCSSearch">
				<div class="rn_SearchInput">
					<rn:widget path="searchsource/SourceSearchField" initial_focus="true" label_placeholder="#rn:msg:ASK_A_QUESTION_ELLIPSIS_MSG#"/>
				</div>
				<rn:widget path="okcs/RecentSearches">
				<rn:widget path="okcs/OkcsSuggestions">
				<rn:widget path="searchsource/SourceSearchButton" initial_focus="true" search_results_url="/app/results"/>
		</form>
	</div>
	</div>
</div>
<div class="rn_PageContent rn_Home">
	<div class="rn_Container">
		<rn:widget path="okcs/OkcsVisualProductCategorySelector" numbered_pagination="true"/>
	</div>
	<div class="rn_PopularKB">
		<div class="rn_Container">
			<rn:widget path="okcs/AnswerList" type="popular" target="_self" view_type="list"/>
		</div>
	</div>
	<div class="rn_PopularKB rn_RecentKB">
		<div class="rn_Container">
			<rn:widget path="okcs/AnswerList" type="recent" target="_self" view_type="list"/>
		</div>
	</div>
</div>

For more information on the OkcsSuggestions widget, see the Standard Widgets section in Using B2C Service.