Faceted search


Söksidan, EPiServer, SiteVision

A user's first search query is often of a general nature, and there is a need for help drilling down in the results. Faceted search is a well established design pattern for guiding the user to the results she expects. When used for e-commerce and product catalogues this pattern will give the best conditions for quick and exact search results.

When using faceted search, the user is presented with a number of categories, called facet values, divided into one or more groups, called facets, after having performed the first search query. If the website contains a lot of information, it is possible to categorise in several steps, and in that way help the user to define the search query even further.

This document describes the steps for implementing faceted search using the .Net Integration Module. It requires version or later.

Faceted search configuration

There are two ways to configure the search index to enable tabbed search, and also specify the behaviour of facets (intersection, multiple-choice and single-choice):

  1. Web.config
  2. Programmatically (.Net Integration Module)

1. Web.config

<add name="exampleSearchIndex" displayName="the example index" url="http://siteseeker-knowledgebase.siteseeker.se/ws/siteseeker-knowledgebase/" userName="ws" password="gnus5/dopier" intersectionFacets="Kunskapsdatabasen" multipleChoiceFacets="" tabFacets="true"/>

tabFacets: Set this to true if you would like the facet values in the Category facet to be rendered as tabs on the search result page.

intersectionFacets: Specify the facets that should return an intersection of results. Use the pipe | character as seperator to specify multiple facets.

multipleChoiceFacets: Specify the facets that should return a union of results. Use the pipe | character as seperator to specify multiple facets.

If facets are not specified as either intersectionFacets or multipleChoiceFacets, they will behave like single choice facets.

2. Programmatically (.Net Integration Module)

To configure faceted search programmatically, bootstrap the system with a search index that is configured as follows (this applies to webforms or mvc scenarios):

var searchIndexConfiguration = new SiteSeekerSearchIndexConfiguration("exampleSearchIndex1", "the example index", "http://siteseeker-knowledgebase.siteseeker.se/ws/siteseeker-knowledgebase/", "ws", "gnus5/dopier", "searchpage");
//configure faceted search
searchIndexConfiguration.TabFacets = true;
searchIndexConfiguration.IntersectionFacets = "Kunskapsdatabasen";
searchIndexConfiguration.MultipleChoiceFacets = string.Empty;

var siteSeekerConfiguration = new SiteSeekerConfiguration();

Make sure that the search index name that you use in the code is unique and does not match one that is already configured in the Web.config. If there is a search index configuration in the Web.config that matches the one used in code, you will see the following error:

Component SiteSeeker.Extensions.Internal.SiteSeekerSearchIndexConfiguration could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.

For an EPiServer scenario, make sure that autoConfigure is set to false, and that instead of SiteSeekerConfiguration, you use EPiServerSiteSeekerConfiguration as follows:

var siteSeekerConfiguration = new EPiServerSiteSeekerConfiguration();

Search Page

To render the required HTML for displaying the tabbed search and facets, do the following:

  1. Call BeginFacetTabs
  2. Wrap a div element around the call to the ResultFacetList and Result methods
  3. Assign the id "tabfacetcontent" to the div element
  4. Include the stylesheet "siteseeker-example-site-tabs.css" (can be found in the example web site projects)
<%= helpers.BeginFacetTabs(Model.Results.First()) %> 
<div id="tabfacetcontent">
<%=helpers.ResultFacetList(Model.Results.First()) %>
<link href="siteseeker-example-site-tabs.css" rel="stylesheet" type="text/css" />