Gravatar for dan@getfishtank.ca

Question by Dan Cruickshank, May 17, 2016 1:26 PM

JSUI - When doing a GroupBy query, can we do a "load more" per grouping?

Hello Masters of Coveo!

We're being tasking with developing a page with two unique groupings of results coming back. Ideally each grouping has it's own "load more."

Can we use a GroupBy query and somehow leverage $('#myResultList').coveo('displayMoreResults', count:number) within these result groupings? Or what is the best approach for creating "load more" functionality within a grouping of results?

To preserve facet count, auto suggest & load more I can imagine a creative solution using three unique instances of Coveo on the page. One managing autocomplete and facets, and the other 2 being ResultLists, with some javascript customization to sort it all out. If we can, I'd like to avoid this option if need be. Thanks!

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, May 18, 2016 11:16 AM

Hi Dan,

First, is there any way you can provide a screenshot/mockup of what you are trying to achieve ? Might help me understand the use case a bit.

With that said, the result list is entirely bound to the display of query results, and not group by results. They are two different data structure and the result list is not adapted to handle both. Facet is the component that displays group by results.

The normal Facet component handle the "more" functionnality by requesting a group by for X value + 1. We display X values, but if we receive X + 1, we display the more button. And when the user click "more", we do the same exact group by request, but with more value. It's just a standard implementation of paging.

So my suggestion for you with the information I have right now would be to use the method provided by the framework to execute queries / add group by requests. And then display those the way you wish.

My gut feeling is that it would be a much simpler and cleaner approach then try to modify existing component for a use case for which they were not designed.

Hope it helps !

Gravatar for dan@getfishtank.ca

Comment by Dan Cruickshank, May 18, 2016 11:37 AM

Here is quick drawing of the comp:

Alt text

URL: http://i.imgur.com/N5DU7lI.jpg

It would be ideal to have 1 instance of JS Search UI on the page, and we could provide a "group by" on the results to separate them into their two distinct types, but for each to have a unique "load more".

The one way I know to do this would be to have 3 distinct JS Searches on the page, each only using partial functionality. One is used to update the facets and search. Group One & Group Two are unique instances which are really only ResultLists, each with a something added to the CQ to scope the results into their respective groups. We have the moves to do this but… ugh. I'd rather not that's for sure!

Gravatar for dan@getfishtank.ca

Comment by Dan Cruickshank, May 25, 2016 8:54 AM

In a cross-post about this very issue, jflheureux confirmed that this approach is not possible in JS Search Framework. Not yet So we're re-working it.

Gravatar for dan@getfishtank.ca

Comment by Dan Cruickshank, May 25, 2016 8:54 AM

https://answers.coveo.com/questions/6502/how-to-init-two-search-components-on-one-page

Ask a question