4

I configured CSWP and set grouping by one of my managed properties,

And I see that the results did not grouped.

Am I missing something that should be set up so that grouping will work?

EDIT:

I defined the grouping by going to the REFINERS tab and clicking on "Show more", and then choosing my property.

EDIT2:

If this is not the way to group the items,

Is there another way to do this?

  • Can you please add the steps you have done? I'm not able to find any Grouping options in the CSWP, only Sorting and Filtering – Robert Lindgren Jun 20 '13 at 7:10
  • @RobertLindgren - I edited my question. – banana Jun 20 '13 at 7:18
  • The problem is in the display template (or lack of) for grouping. Only the Search Result Webpart has a corresponding "Group_Default.html" display template that does the display logic. The CSWP does not have this. The question is, can this be added somehow? – user45220 Aug 19 '15 at 14:24
4
+50

On OP:s request, this comment is now posted as an answer:

The Grouping has really nothing to do with grouping the items, what it does is helping you get rid of search results that is essentially the same file, but that are retrieved from different locations. So it is a way of eliminating "Duplicates" in the search results

2

I assume you mean grouping a search results by a managed property such as organisation or location, and these kind of things. That you have a result which displays content grouped by for instance location.

If this is the case and you want to group result from a single query, you have to edit the web part and change the query.

  1. In the Web Part, click the Web Part Menu --> Edit Web Part.
  2. In the Web Part tool pane, click Change query. This opens a dialog box.
  3. In the dialog box, from the Select a query list, select your result.
  4. Click Switch to Advanced Mode. In Advanced Mode, in the Query text field, you’ll see some text. This is the query text that represents your result. Switch to advanced mode CSWP

  5. In the Property filter list box, select Show all managed properties, and select your managed property.

  6. Click Add property filter, and select a second prtoperty (if you need to).
  7. To test that this query returns the correct results, click Test query.

Reference and tutorial: Configure the query in a Content Search Web Part on a catalog item page


If this is not the case, and you need to merge differnt result sets, then you need to do is Create and display a result block. There you have the option to group search results in different reult blocks.

A result block is several search results that are displayed as a group. In the same manner as you can promote a specific result, you can promote a result block when a specified query condition applies. For example, you can create a result block named Yellow items for all catalog items that have the color yellow. In an Internet business scenario where you have a catalog of electronic products and you want to promote yellow mp3 players, you can create a query rule that fires for all items that are tagged with the term mp3 players, where the action is to display the result block Yellow items.

  • I managed to filter and get the results I want, what I need is the grouping. I defined in the REFINERS tab grouping by one of my columns, but the results I get - not grouped. What can be the reason? – banana Jun 20 '13 at 7:13
  • 2
    The Grouping has really nothing to do with grouping the items, what it does is helping you get rid of search results that is essentially the same file, but that are retrieved from different locations. So it is a way of eliminating "Duplicates" in the search results – Robert Lindgren Jun 20 '13 at 7:29
  • @RobertLindgren - So how can I group my results? When I debug the javascript file I can see that the object 'ctx' contains properties named 'CurrentGroupIdx' (that always contains 0) and 'CurrentGroup' (this is an object, and it always contains all the results). What is their meaning if there is no possibility of grouping? – banana Jun 20 '13 at 8:30
  • I think does are used by the search result webpart to show Promoted Results, and "Did you mean" stuff – Robert Lindgren Jun 20 '13 at 9:03
  • 1
    I still think Benny's answer is valid in relation to how the question is written, I was just pointing out the logic behind grouping :) – Robert Lindgren Jun 26 '13 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.