Result Groups

What is the "Result Group" feature?

Result groups may appear to be a techy, niche sort of thing, but I bet you actually have first-hand experience with them.

Websites often separate content into categories. Here's a nifty example for you:

Product categories on a homepage

This is the homepage of a site maintained by Primark, a fashion retailer. All of their products belong to categories that correspond with the purpose each product serves to make navigating the site easier for its users.

Result Grouping functions in the exact same way except it categorizes search results. These groups only show up when a query is entered into the search box.

Here's how Primark separates its search results:

If a user searches for the term "jeans", they would see several product groups reflecting who can potentially wear each pair. This way, if someone's looking for "women's jeans", they wouldn't need to scroll through pages upon pages of products made for men or children - all available options are already organized into a separate category.

While product categories and non-commercial website sections are on equal footing in the header of the homepage, Primark’s search results unite womenswear, menswear and kidswear under “Products”. Thus there are only four Result Groups: "Products", "Inspiration", "Cares", and "More". The highlighted tabs are filters which allow for more precise segmentation of Result Groups.

That is of no consequence to us if we want to have all of these categories be presented as Result Groups. We can easily set up eight separate groups to mimic the homepage.

In this article we would explore the following:

  1. How to create Result Groups

  2. What’s the difference between Result Groups and Filters and how to choose between them

  3. How to show Result Groups in the search or hide them from it

  4. How to set up different Result Groups for multiple search boxes

  5. How to work with Result Groups through API

Let’s get to it!

How do I set up Result Groups?

All settings related to Result Groups are available under "Result Grouping" in the "Data Structuring" section of your Control Panel:

To configure a Result Group, simply press the "+ Add Result Group" button, opening the following pop-up window:

This menu lets you define the look and feel of your Result Group:

  1. Name of the Result Group - stands for the title of the Result Group, best kept short for easier navigation.

  2. Data Points to Show in Result Snippets (optional) - lets you select between previously configured Data Points to present them underneath each URL's title and enrich the description of the page. Here's what a price Data Point would look like in the snippet:

    You can learn more about this in our Data Points article as well as in our guide about price Data Points exploring the feature in conjunction with Result Groups and Filters.

  3. Result Group Condition selector and input - establishes the defining criteria for the pages that are supposed to be included in your Result Group. There are two ways to go about this:

    • URL Pattern (regular expression) is a category indicator within the page's URL. If you take Primark's women's shorts catalog for instance, you'll see that /womenswear/ in its URL (https://www.primark.com/en-us/all-products/womenswear/clothes/denim-smart-women/c/womens-shorts) signifies the gender of the person whom these shorts were designed for. Men’s catalog would have /menswear/ in the URL. These indicators will let our crawler pick out all pages where womenswear (or menswear) is present and group them.

    Tip: If you want both womenswear and menswear to be included in the Result Group, you can simply type in all relevant URL Patterns and put a pipe separator | between them. In this case, you’d go for /womenswear/|/menswear/.

    • XPath extraction lets you highlight specific elements available on all pages you want to group.

    Here’s an example:

    At the very top you'll find breadcrumbs that link to catalog pages: all products available for women, women's clothing, women's pajamas, etc.

    You can use any of these breadcrumbs to create Result Groups like "Clothes" or "Pajamas", but if you are categorizing womenswear in general, the most fitting XPath would be //a[contains(@class,"breadcrumb__link")]//span[contains(text(),'all women')]. Once you enter it as a Result Group Condition, all pages where this element is present will be united under "Women".

    If you want to read up on how to extract and use such expressions, look no further than our article on XPaths.

  4. Override Global Extraction Settings (optional) - consists of four buttons that will help you fine-tune extraction rules for your Result Group.

    This doesn't relate solely to the content of the page that can be excluded or included in the group. You can also define which titles and images are to be extracted from your website.

    The “Content Extraction” tab under “Data Structuring” allows you to do the same but for the entire project. These settings are limited to specific Result Groups and can thus contradict the general extraction rules.

    Check out the aforementioned XPath doc for more info.

Once these settings are defined, click the "Add" button in the bottom right corner of the pop-up window, save the changes and re-index your project for the Result Group to become visible in your search.

Bear in mind that starting with version 13 of our search script, Result Groups are displayed as tabs by default, with "All Results" preceding the rest of the groups. This can be adjusted under "Plugin Configuration" in "Design & Publish" and layout.navigation specifically:

var ss360Config = {
    layout: {
        navigation: {
            position: 'top', /*can also be 'left'*/
            type: 'tabs', /*can also be 'scroll'*/
            showAllResultsTab: true,
            allResultsTabName: 'All Results',
            allResultsTabTitle: 'Found #COUNT# results for \'#QUERY#\'' /*e.g. 'Found 43 results for "curry"'*/
        }
    }
}

You can check out your Result Groups in action even if the search is not yet implemented to the site by entering a sample query in the Search Preview tab. You can also see what the search would look like on your site by typing in your website's URL under "Design & Publish" and clicking "Fullscreen preview".

Here's the final look of our Primark Result Groups:

Result Groups corresponded with our needs here but that is not always the case.

What’s the difference between Result Groups and Filters and how do I choose between them?

Result Groups are mutually exclusive, so if a page is assigned to a certain category, it cannot appear in any other even if one extraction pattern can be found in numerous Result Groups. The only exception is "All Results" which shows all indexed URLs regardless of which group they ultimately belong to.

That’s why sometimes it’s better to use Filters instead of Result Groups. The general rule of thumb here is as follows:

  • If you want to configure high-level categories which clearly separate different types of content, Result Groups would be perfect. An example of this would be a catalog with no products for both women and men.

  • If certain pages can and should be found in numerous categories, like if the catalog has a lot of unisex items, Filters would be the way to go.

  • If you want to separate your website’s content into more than 5-7 groups, Filters would serve you best. With that many Result Groups your search results page might appear too cluttered.

We decided to spice our search results up with a Price filter:

You can learn more about setting up filters in our Filters article.

How do I control which Result Groups are shown and which are hidden?

First things first, you need to account for the version of the script you're using.

Our latest search script comes with a new Search Designer which lets you configure everything about the search right on the project page - no coding required!

All relevant settings can be found in the “Design & Publish“ section of your project page under "Configure your search result behavior":

  1. The "Navigation" part of the tab is all about the way your Result Groups function within the search.

    • Group results - allows you to either show your Result Groups in the search or hide them.

    • Show "All results" tab - responsible for displaying (or not displaying) the group that unites URLs available in all of the configured Result Groups.

    • Show uncategorized results - offers you control over pages that don't fit the defining criteria of any Result Group and are therefore pushed into the "Other" category.

    • Uncategorized tab name - lets you select a different name for the “Other” Result Group.

  2. At the very bottom of the tab there is a section with separate toggles for each Result Group that allows you to show/hide any one of them while keeping the rest fully functional and present in the search.

Much easier than coding, right? And that's not the only cool thing about v14 - check out our New Search Designer article to learn more about its perks.

If you’re still using an older version of our script, consider upgrading to unlock all our latest features. Otherwise, configuring whether Result Groups are shown or not would require editing the HTML structure of your website.

There are two interchangeable parameters responsible for the visibility of your Result Groups - include and exclude.

Say, you want to limit your search solely to "Products" and "Reviews", ignoring all other groups and URLs that might be present in them. You can set this up in two ways:

  • Add data-ss360-include or data-ss360-exclude attributes to the HTML markup of your search box:

<input type="search" data-ss360-include="['Products','Reviews']">

If you are using our WordPress search plugin and you are not sure how to access or edit the search input HTML markup, you can add a new search box with shortcodes and configure the limitation there instead:

[ss360-form][ss360-searchbox include="'Products','Reviews'"][ss360-searchbutton][/ss360-searchbutton][/ss360-form]
  • Adjust the ss360Config code:

var ss360Config = {
    contentGroups: {
        include: ['Products','Reviews']
    }
}

How do I show different Result Groups for multiple search boxes?

Site Search 360 can accommodate the most complex of setups, and configuring multiple search boxes for one project is but a piece of cake.

Each search box can have a unique set of Result Groups associated with it. Take a look at this demo for example. One search box includes entries from all configured Result Groups, but the second one is limited to a single category ("Menu items"), which is why search results for the two are drastically different.

If you have multiple search boxes and they're supposed to show/hide the exact same groups, you can stick to the Design & Publish settings. Make sure to connect Site Search 360 to all your search boxes by specifying their CSS selectors under "General" and then switch the desired Result Group toggles ON under "Results".

If you want your search boxes to include different Result Groups, you’d need to adjust the HTML structure of your website. This can be done in several ways:

  • Add data-ss360-include or data-ss360-exclude to the HTML markup of both search boxes just like you would if there was only one:

    <input type="search" data-ss360-include="['Group 1','Group 2']">
  • Implement the full ss360Config object that can be found under "Plugin Configuration" in "Design & Publish" instead of our one-line JS bundle and restrict different search inputs to specific Result Grousp directly in the code with the interchangeable contentGroups.include and contentGroups.exclude parameters.

    The setup for the first search box might look like this:

    contentGroups: {
            include: ['Group 1','Group 2']
        }

    And the second one would be:

    contentGroups: {
            include: ['Group 3']
        }

    or

    contentGroups: {
            exclude: ['Group 1','Group 2']
        }

The data-ss360-include and data-ss360-exclude attributes also affect your search suggestions.

If you want to show different groups in the search suggestion dropdown, you'll need to adjust the HTML by adding data-ss360-include-suggestion and data-ss360-exclude-suggestion attributes to your search inputs respectively. To include all possible results and suggestions in the search simply leave data-ss360-include="[]" empty.

Remember that if there are several groups to include or exclude from search results and/or search suggestions, they need to be formatted as a JSON Array and separated by a comma, like ['Group 1', 'Group 2', 'Group 3']. The group names must match the names given in the Result Grouping section or the search will go haywire.

There's quite a lot you can do with your Result Groups functionality-wise. The same can be said about their design! If the default look of the Result Groups buttons doesn't fit your website's aesthetic, you can always tinker with it via custom CSS.

Result Groups and API

Pages included in the Result Groups are usually indexed through Root URLs or Sitemaps, but some tech-savvy users opt for API to have more granular control over their search.

You can use SS360's HTTP REST API to add content to the index as well as assign each indexed page to the appropriate Result Group directly in the JSON object sent to the API.

Here's what your API setup might look like (grouping is defined with contentType here):

{
  "url": "https://test.com",
  "title": "My page title",
  "content": "This is a simple test page",
  "contentType": "Services",
  "imageUrl": "https://test.com/image.jpg",
  "structuredData": [
    {
      "key": "value"
    },
    {
      "Price": "$5"
    }
  ],
  "filters": [
    {"key": "value"},
    {"votes": 12},
    {"tags": ["abc","def"]},
  ],
  "language": "english"
}

You can also use API to configure which Result Groups should be shown and which should be hidden by adding includeContentGroups or excludeContentGroups to your requests. Here's an example:

https://global.sitesearch360.com/sites?query={QUERY}&site={SITE_ID}&filterOptions={FILTER_OPTIONS}&filters={FILTERS}&sort={SORT}&sortOrder={ORDER}&offset={OFFSET}&limit={LIMIT}&includeContent={INCLUDE}&highlightQueryTerms={HIGHLIGHT}&includeContentGroups=['Group 1','Group 2']&log={LOG}

And that's a wrap on Result Groups!

If you have any questions about this feature or any other aspect of working with Site Search 360, make sure to drop us an email! We'd be happy to help :)