What is the result group feature and how do I use it?
This article explains the importance of result groups and shows a way to implement the result group feature in SS360.
Websites often separate content into categories. Take for example the news website today.com. In the above screenshot you can see their category navigation, which groups all their articles into categories like videos, food, or health & wellness.
If you group your content into categories of course you want to have them mapped to your search engine.
If a user searches for the term "Jimmy Fallon" on today.com, SS360 would deliver all hits within all categories in one big list. But what if the user is only interested in videos with "Jimmy Fallon" out of the "video" category or if he wants to see the cooking tips out of the "food" category?
To solve this issue, you can define result groups for the SS360 search engine. This way it is possible to generate category filters that may be clicked to reduce the huge list of initial results to a subset of hits within the chosen category.
How do I set up Result Groups?
You will find all settings related to Result Groups in the control panel under "Data Structuring > Result Groups".
Press the "Add result group" button to open the pop-up Result Group creation menu:
The menu lets you define all the settings needed to get the Result Group up and running.
Let's take a look at each setting in detail.
Name of the Result Group - this will be the title of the Result Group visible for your search users. It's best to keep it short and simple.
Show this result group in search results switch - turn it on to show the Result Group in the results. You can turn it off if the Result Group is meant to be used only in suggestions.
Show this result group in search suggestions switch - turn it on to show the Result Group in the suggestions (the preview of the search results displayed when you type your search query). You can turn it off if the Result Group is meant to be used only in results.
A maximum number of items to show in suggestions - define how many items from this Result Group will be displayed in the preview of the search results displayed when the user is typing his search query.
You can limit this number to avoid getting too many results from one Result Group in suggestions.
URL Pattern/XPath selector - decide how do you want to define which pages will be included in your Result Group.
Remember that each page can be included in only one Result Group at a time!
URL Pattern/XPath input
Here you can tell the system how to recognize a result group on your site. The input type depends on the selection made with the selector described above.
6.1 URL pattern (regular expression): If you navigate on today.com to the food category the URL changes and may look like "https://www.today.com/food/feel-better-foods-tips-recipes-dr-oz-t116700". The indicator for the food category is the /food/ element in the URL. This way we will catch all the URLs with /food/ - so this is the value that should be used in this input.
Another example: when you click the navigation point "Health & Wellness" the URL changes to "https://www.today.com/health/cvs-limit-opioid-prescriptions-7-day-supply-t116587", so for this result group the indicator would be /health/.
If you want to catch multiple URL patterns just use a pipe separator
|. For example, /food/|/health/ would catch both URLs and put them in the same result group.
6.2 XPath: If your URLs don't indicate the category you want to make into a result group you may use the XPath feature. Here you can point to a unique DOM element that is only available on pages that should go into this result group.
Coming back to our today.com example, we can check the source code for unique elements within a page in the "Health&Wellness" category. Near the headline of each article in this category, you find a link to the category overview page, which could serve as an indicator for this result group.
A valid XPath expression to find this indicator would be //div[contains(@class, 'articleTitleSection')]//span[contains(text(),'Health & Wellness')]
Only the existence of this indicator will classify this page as part of the result group "Health & Wellness"
Override options - 4 buttons at the bottom of the window can help you with fine-tuning the content extraction for your new Result Group. You can define the group-specific title, image and content inclusion/exclusion rules.
More about content extraction can be found in this article.
After you have defined your Result Group click on "Add" and then "Save". Your changes will be visible after the next site reindexing.
Once it's done you can check your results in the Search Preview tab:
You may style the Result Groups buttons any way you want, it is fully customizable via CSS.
Using the API
If you want full control over your search and the search result page you may use the SS360's HTTP REST API to add content to your index. It's possible to set the appropriate Result Group for each page you index directly in the JSON object you send to the API.