1

I'm using Sitecore 9.1 and SXA 1.8, I created a JSON result and configured it as below: enter image description here

The JSON result response doesn't contain the results count, as in SXA search result component request-response, I need this count for pagination, Is there is any OOB solution for this.

JSON Result Response: enter image description here

1

No, you won't get the results count in JSON Results response. Search Results and JSON Results responses are completely different things.

In order to do that, you would need to make some modifications to RenderJsonVariantList method in Sitecore.XA.Foundation.JsonVariants.Extensions.JsonVariantsExtensions.

Ideally:

  • copy the JSON Results rendering and provide your own view
  • create your own extension method (modification of RenderJsonVariantList method) and use in on that view (you will know where when you will investigate original view)
  • in your extension method modify the output of the IJsonRendererFactory and add additional results count property to the JSON object

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.