Does content rating affect search relevancy?

Tom Troughton asked on May 13, 2015 18:27

Hi. Does anyone know if using the Content rating web part affects search relevancy in any way? e.g. higher rating pages boosted in results.

Ref: https://docs.kentico.com/display/K8/Using+the+Content+rating+web+part

Correct Answer

Brenden Kehren answered on May 13, 2015 19:41

If your talking about search relevancy using Smart Search the answer is "it could" but not out of the box. You'd have to create a custom smart search provider to do the work for you and then add to the weight by checking the rating for that document.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Charles Matvchuk answered on May 13, 2015 19:01

No it doesn't.

2 votesVote for this answer Mark as a Correct answer

Rui Wang answered on May 13, 2015 19:29

Some of the things that I know would affect the search relevancy scores are metadata title, description, keywords

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 10, 2015 21:15

What you can do is override the Smart Search Content indexer (see example below), find the Content Rating for the document and add it as a searchable field. Then add a hidden Smart Search Filter that adds boosted weights based on the Rating, like the below:

ContentRating('five')^2 ContentRating('four')^1.5 ContentRating('three')^1 ContentRating('two')^.5 ContentRating('one')^.25

This would add heavier weights to higher rated content.

using CMS.Base;
using CMS.DocumentEngine;
using CMS.Membership;
using System.Collections.Generic;

[SmartSearchContentLoader]
public partial class CMSModuleLoader
{
    /// <summary>
    /// Attribute class for assigning event handlers.
    /// </summary>
    private class SmartSearchContentLoaderAttribute : CMSLoaderAttribute
    {
        /// <summary>
        /// Called automatically when the application starts.
        /// </summary>
        public override void Init()
        {
            // Assigns a handler to the GetContent event for pages
            DocumentEvents.GetContent.Execute += OnGetPageContent;
        }

        private void OnGetPageContent(object sender, DocumentSearchEventArgs e)
        {
            // Gets an object representing the page that is being indexed
            TreeNode indexedPage = e.Node;

            // Checks that the page exists
            if (indexedPage != null)
            {

                // Get the content rating here
                float ContentRating = GetThePageContentRating(e.Node);

                string WordContentRating = "";
                if(ContentRating >4) {
                        WordContentRating = "five";
                } else if(ContentRating >3) {
                        WordContentRating = "four";
                } else if(ContentRating >2) {
                        WordContentRating = "three";
                } else if(ContentRating >1) {
                        WordContentRating = "two";
                } else {
                        WordContentRating = "one";
                } else
                // Adds the value as a searchable/filterable/weightable field
                e.SearchDocument.AddGeneralField("ContentRating", WordContentRating), true, false);

            }
        }
    }
}
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.