0

I am using Sitecore 10.1 with SXA, I have a page that contains search results component and I have noticed that the query that is generated and run on SOLR is retrieving all the fields in the response. Is there a way to override this behavior and return only the fields that will be displayed in search results component?

0

There is no way to do that out of the box. You would need to override Sitecore.XA.Foundation.Search.Services.SearchService in order to change the way how the query is generated. Right now we are using Sitecore.XA.Foundation.Search.Models.ContentPage as a query return type. It contains a few SXA specific fields and inherits from the Sitecore Sitecore.ContentSearch.SearchTypes.SearchResultItem class which contains a loooot of fields (as you notice it).

So technically it is possible but I strongly recommend not to do that as you will end up overriding a few classes while the Search Results component is using paging anyway (you are not getting all of the items and all of the fields at one time).

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.