I am trying to develop a custom paging control for my search results webpart but I am facing a weird issue that the search results return wrong total results count. Below is the javascript snippet I use in my control template.

var pagingInfo = ctx.ClientControl.get_pagingInfo();
    showPaging = !$isEmptyArray(pagingInfo);

        var currentPage = null;
        var firstPage = pagingInfo[0];
        var lastPage = pagingInfo[pagingInfo.length - 1];

        // Additional variables to support desired paging style
        var currentPageNumber = null;
        var firstPageNumber = 1;
        var totalRowCount = ctx.ListData.ResultTables[0].TotalRows; 
//lots of other code below

I have done some initial troubleshooting and I know that the reason for this wrong results is that, in my webpart setting I have configured grouping of the results and take 1 (screenshot below). enter image description here

If I remove the above settings then this works fine. So I suspect that the ctx.ListData.ResultTables[0].TotalRows does not respect grouping. Is there any other way for me to keep this settings and still get an accurate count.

Additional Info: The grouping is important for me as I want the search keyword to be matched across whole content but only return one result if multiple results are found inside same DocumentSet. So avoiding the multiple results by changing query to match for only document sets is not a good option.

Looking forward for your inputs !!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.