Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Boosting based on depth of page

Vote:
 

Hello guys, 

I'm looking for a way to boost my pages based on their depth (the higher up the page, the higher the boost).

For example:

  • Home (boost 3)
    • Theme (everything on this level should get boost 2)
      • SubTheme (everything on this level should get boost1)
        • Detail page (everything on this level should get boost no boost.

Current function:

public static SearchItems SiteSearch(string q, int? p, int pageSize)
        {
            p = p ?? 1;          

            var results = SearchClient.Instance.UnifiedSearchFor(q)
                .ApplyBestBets()
                .Filter(x => !x.MatchType(typeof(ImageFile)))
                .BoostMatching(x => x.MatchTypeHierarchy(typeof(SitePageData)), 1)
                .Skip((p - 1) * pageSize ?? 0)
                .Take(pageSize)
                .StaticallyCacheFor(TimeSpan.FromHours(1))
                .GetResult();

            return new SearchItems
            {
                SearchResults = results.Select(x => new SearchItem(x)).ToList(),
                ExecutionTimeInMS =  results.ProcessingInfo.ServerDuration,
                NumberOfHits = results.TotalMatching
            };
        }

Thanks in advance!

#185859
Edited, Dec 05, 2017 11:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.