Skip to main content

Result Groups

Result groups sort your search results into sections such as Products, Blog or Support. Visitors see each group as a tab, with an All Results tab first, so they can go straight to the kind of page they want.

Search results for "history" shown as tabs: All Results, Products, Book Categories, Authors and Other, with the tab row outlined

Where to find it: Data Structuring → Result Groups

Before you start: A URL pattern or an XPath that matches the pages of each group; see Working with XPaths.


How pages are grouped​

  • Each page is in one group. Site Search 360 checks your groups from the top of the list down, and a page joins the first group whose condition it matches.
  • Other collects the rest. Pages that match no group go to the Other group. You can rename or hide it in Design & Publish (Show result groups as tabs).
  • All Results shows everything. The All Results tab lists every result, whatever its group.

Create a result group​

  1. Click Add Result Group.
  2. Enter a Result Group Name. Visitors see it as the tab name, so keep it short.
  3. Under Result Group Condition, choose how pages join the group:
    • URL Pattern: a regular expression that matches part of the URL, for example /blog/. Separate several patterns with a pipe: /blog/|/news/.
    • XPath: pages that contain the element join the group, for example a breadcrumb item: //nav[@class='breadcrumb']//a[text()='Blog']. PDFs never match an XPath group.
    • Attribute (Content + Product Search projects): products with a given attribute.
    • API Based: pages you send through the API with this group's name.
  4. Optional: under Data Points to Show in Result Snippets, add the data points to show below each result's title, in the order shown.
  5. Optional: under Override Global Extraction Settings, use Add Title XPath, Add Image XPath, Add Include Content XPath or Add Exclude Content XPath to extract this group's pages differently from the Content Extraction settings.
  6. Click Create, then Save.

When the group shows up​

  • URL Pattern groups are filled in the background a few minutes after you save, without a re-index.
  • Re-index (how) for XPath groups, for changes to a group's data points, and when you remove or narrow a URL pattern, so pages that no longer match move back to Other. Projects that also add pages through the API (most WordPress plugin projects) need a re-index for every change.

To check the result, search in Search Preview.


Order result groups​

The Result Groups list with the Automatically order result groups checkbox marked 1 and the drag handle of a group marked 2

The tabs follow your list, unless Automatically order result groups (1) is on. Then the group with the most relevant results for each search comes first.

Automatically order result groups overrides your drag-and-drop order while it's on. Turn it off to go back to your manual order.

To set the order yourself, turn off Automatically order result groups, drag the groups by their handle (2), and click Save. All Results always stays first.


Result groups or filters?​

  • Use result groups for a few broad sections that don't overlap, such as Products, Blog and Support.
  • Use filters when a page belongs in several categories at once, such as a unisex product that is both men's and women's wear.
  • Use filters when you need more than about 5–7 categories: that many tabs crowd the results page.

You can combine them: filters work inside each group.


Show result groups as tabs​

The tabs are set in Design & Publish → Settings → Results:

  • Under Navigation:
    • Group results turns the tabs on or off.
    • Show "All results" tab? shows or hides the All Results tab.
    • Show uncategorized results shows or hides the Other group.
    • Uncategorized tab name renames the Other group.
  • Under Result Groups: one toggle per group shows or hides that group in the results.

In code, the same settings are layout.navigation and contentGroups in your ss360Config:

var ss360Config = {
layout: {
navigation: {
position: 'top', // 'left', or 'none' for no tabs
type: 'tabs', // or 'scroll'; with more than 6 groups on top (10 on the left), 'scroll' is used
showAllResultsTab: true,
allResultsTabName: 'All Results',
allResultsTabTitle: 'All Results (#COUNT#)' // #COUNT# and #QUERY# are replaced
}
},
contentGroups: {
otherName: 'Other', // the name of the Other group
ignoreOther: false // true hides the Other group
}
}

To connect several search boxes, list their selectors, separated by commas, in Design & Publish → Settings → General → Search box selector, for example #searchBox, #searchBox2. All of them then search the groups you show in Design & Publish.

To limit one search box to some groups, for example a recipe search that shows only "Recipes":

  • Add data-ss360-include to the search input:

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

    Use data-ss360-exclude to hide groups instead. Group names must match the names under Result Groups exactly.

  • Or set it in the ss360Config of that search box:

    contentGroups: {
    include: ['Recipes', 'Reviews'] // or exclude: ['Blog']
    }

The attributes also limit search suggestions. To limit suggestions differently, use data-ss360-include-suggest and data-ss360-exclude-suggest. data-ss360-include="[]" includes everything.

With the WordPress plugin, use the shortcode instead:

[ss360-form][ss360-searchbox include="'Recipes','Reviews'"][ss360-searchbutton][/ss360-searchbutton][/ss360-form]

See Multiple search boxes for a demo with two search boxes.


Add pages through the API​

When you add pages with the REST API, set each page's group in the contentGroup field. A group name that doesn't exist yet creates an API Based group:

{
"url": "https://example.com/services/consulting",
"title": "Consulting",
"content": "We help you plan your search.",
"contentGroup": "Services"
}

To search only some groups through the API, add includeContentGroups or excludeContentGroups to the search request, as a URL-encoded JSON array: &includeContentGroups=["Services","Blog"].