Filtering Search Results by Category

The Filter by Category feature helps a site visitor zero in on relevant content.

As explained in Taxonomy, the Taxonomy Feature lets users assign information categories to content. For example, if your organization is a university, taxonomy categories might be Athletics, Alumni, Admissions, Academic Departments, etc.

As new content is created, users should apply relevant taxonomy categories to it. This makes it easier to find content on your site, because a site visitor can search by category along with search terms. For example, if the search term is calendar, and the category is Athletics, the search would typically return calendars of the sports teams but not other calendars, such as those for graduation, exams, or parents weekend.

To let users filter search results by category, set the ShowCategories property to true. (The ShowSearchBoxAlways property must also be true.)

Tip! 

Note: This additional search criterion depends on the assignment of taxonomy categories to your content. If they are not, the filter hides relevant but unclassified content. For example, someone authors an article on “Treating Heart Disease” but doesn't assign a taxonomy category to it. If a site visitor on the search page selects Filter by Category then the Medical Forum > Heart Disease category, he will not find that article.

As a developer, you can control whether the results must match all categories selected in the Filter by Category tree or match at least one category. To display results that must match all categories, set the TaxonomyOperator property to And. To show results that match one or more categories, set TaxonomyOperator to Or. By default, the property is set to Or. This allows for a wider range of returned results.

Effect of Setting ShowCategories to True

If you set the ShowCategories property to true, initially the site visitor sees no difference. However, if he enters a search term that exists in content to which a taxonomy category is assigned and clicks the Search button, he sees Filter by Category above the results (illustrated below).

Note: If no categories are assigned to the content in the search results, the Filter by Category link does not appear.

Filtering Search Results by Category

If he clicks Filter by Category, the visitor sees all taxonomies with at least one content item that contains the search term. He can then select categories from the taxonomies. If he does, the results refresh, and only content that contains the search term and is assigned to the selected categories appears.

If a visitor selects more than one category, the TaxonomyOperator property determines which content appears.

TaxonomyOperator property value

This content appears in search results

and

content assigned to all selected categories

or

content assigned to any selected category

Note: If the visitor selects a parent category, all of its child categories are selected by default.

In the sample below, the site has 15 content items with the word treatment that are assigned to the Medical Forum taxonomy.

If the user drills down to the Treatment category, only one content item is found.

If a site visitor performs any of the following actions, all taxonomy category selections are cleared, and a new search is performed.

clicks the Search button

presses <Enter>

uses the document type dropdown (site, multimedia, images, etc.)

performs an Advanced Search

On the other hand, if a site visitor closes folders in the taxonomy structure, all selected categories remain selected.

Previous TopicNext Topic|