2

I have several items (news stories) that are contained within a section (like a category) that span multiple issues and publications. The sections are mostly repeated in every issue and many times the sections are in the other publications as well. What I want search to return is a list of all items that are contained within the same section regardless of publication or issue.

I think the correct answer is to add the section identifier field value from the section item into the index on the story item document that I'm searching against. But I'm having trouble finding a good source on how to do that using Sitecore 8. More specifically I'm using Azure Search, but that only changes a few things that I think I've been able to figure out.

For simplicity I'm just using the default sitecore_master_index for now at least. I'll probably create my own index specifically for this and other purposes.

1 Answer 1

3

You should create a computed index field that is filled only for your news stories items. The computed field value would be the parent section name or ID. That way, you would be able to query for the news stories by section.

For more information on computed index fields: https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-7-computed-index-fields

2
  • In the linked site John says to add the fields to the DefaultIndexConfiguration node. When I do, I'm getting an error in Sitecore. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Could not find property 'DefaultIndexConfiguration' on object of type: Sitecore.ContentSearch.ContentSearchConfiguration at Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties) ...
    – Kevin
    Mar 30, 2017 at 13:23
  • This section's name is different now in Sitecore 8.X and also depends on the search provider you are using. For Lucene it's sitecore/contentSearch/indexConfigurations/defaultLuceneIndexConfiguration. For Solr it's sitecore/contentSearch/indexConfigurations/defaultSolrIndexConfiguration. For Coveo it's sitecore/coveo/defaultIndexConfiguration. Mar 31, 2017 at 13:27

Your Answer

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

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