Environment: SXA 1.8 in Azure PAAS + Azure search

What I have: My client has multiple offices and each office has its individual page managed with SXA. The fields on this page include address and many similar relevant fields. Upon indexing, these page items are getting indexed to Azure. The contents populated are visible inside field 'sxacontent', as can be seen in the image below.

enter image description here

My problem: How to read value populated for particular fields in the page item?

1 Answer 1


The sxacontent computed field is used for searching. In the SXA you will find Search Box where you can search for items. We are using that computed field which aggregate texts form whole item (and related items in some cases) so that you could easily find a particular item.

Now... You don't need to manually access fields in the index (unless you have a purpose of doing that). Sitecore search providers will handle everything for you. And when you have SXA installed if you would like to display different data all you need to do is to play with Rendering Variant. For example, if I would like to display Office hours and Key information fields in the SXA Search Results rendering I just need to define a Rendering Variant:

enter image description here

If you are more advanced and you would like to play with the queries in code here is an example:

//get search index
ISearchIndex searchIndex = IndexResolver.ResolveIndex(Sitecore.Context.Item);
//create query
IQueryable<ContentPage> queryable = LinqHelper.CreateQuery<ContentPage>(searchIndex.CreateSearchContext(), new List<SearchStringModel>());
//play with the query (e.g. use fields from your template)
queryable = queryable.Where(x => x.Name == "MyName");
//get items which match your query
IEnumerable<Item> items = query.Select(r => r.GetItem());

I'm using here some SXA specific services like IIndexResolver or classes ContentPage. If you would like to use pure Sitecore Content Search API just google for it, there is plenty of tutorials.

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.