Boosting based on depth of page


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)
                .Filter(x => !x.MatchType(typeof(ImageFile)))
                .BoostMatching(x => x.MatchTypeHierarchy(typeof(SitePageData)), 1)
                .Skip((p - 1) * pageSize ?? 0)

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

Thanks in advance!

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.