Working with Sitecore 9 (Update 1), SXA 1.7 and Azure Search.

I am using the Map component along with Location Finder and Search Results component. I want to do some changes on the results thrown by SXA search in JSON format before rendering it on the page.

For instance, I have 10 POIs when I search for a location in the Location Finder component, Search Results will populate the results from the search and render it according to the Rendering Variant. Is there any way to get all the results and do something with it?

2 Answers 2


Modification of results items before sending them to the front-end scripts might be hard in SXA 1.7. You would need to:

  • override SearchController and modify GetResults() method - this method is building a query, getting items and preparing ResultsSet which later on is sent to the front-end
  • replace controller in DI container

It is possible but I do not recommend going that way.

Another option is to modify the results on the front-end. Search Renderings are using events to notify that e.g.: results have been loaded from the server. You can modify the list of listeners for results-loaded event and put your handler at the first place. It can modify the list of results loaded form the server and modify them before notifying other renderings. Keep in mind that the HTML (which is present in JSON) will be already processed by Rendering Variants. And this is probably not what you want...

The best option would be to update to SXA 1.9 where you will find new custom pipeline called processSearchItems. This pipeline is triggered after getting items but before processing them by Rendering Variants and sending to the front-end. This is the perfect place to so some modification to the list of results. You can even bind your results to additional models (basically custom object) and process this later on by Variants Model item.

Arguments of that pipeline contain two properties:

public List<Item> Items { get; set; }
public List<SearchItem> SearchItems { get; set; } 

Where SearchItem contains:

public Item Item { get; set; }
public object Model { get; set; }

The model property gives huge flexibility to transfer additional data to Rendering Variants. You can, later on, use this Model property in those two Variant Items:

enter image description here


From the question I understand that you want to change the way the result is getting rendered on the page. For this

a. Make a copy of existing view file

b. Then make changes according to your requirement. Save It.

c. Next you have to follow steps on https://doc.sitecore.com/developers/sxa/17/sitecore-experience-accelerator/en/copy-and-customize-a-rendering.html#UUID-bc2af07b-4427-3f64-04a5-a665ba26aa85_id__Copy_and_customize

  • 2
    This will not help here. It is not about cloning the rendering, the question was about modifying results which come from the server (before they are processed by Rendering Variants). Aug 28, 2019 at 10:24

Your Answer

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

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