Our website has a search feature where the user types in a keyword and the results page lists out links to all the pages that the keyword is found on.

We want one particular page to come up at the top for one specific search term. The term is "download".

How can I get that one specific page to always be the first result for the "download" search?

We are using SOLR.

Sitecore 8.1 Update 3

1 Answer 1


If you want it guaranteed to be the first result any time the term download is used, you might be better off manually adding it to the top of the list when you detect that word. Its a bit of a hack, but would guarantee the result you want.

If you want to do it by boosting, your code will need to add that page ID to the query and boost that. You can use the PredicateBuilder to do it, something like:

using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
    var forcedPageId = new ID("your pages guid");
    Expression<Func<SearchResultItem, bool>> innerPredicate = PredicateBuilder.True<SearchResultItem>();

    if (searchTerm.Contains("download"))
        innerPredicate = innerPredicate.And(i => i.Content.Contains(searchTerm))
            .Or(i => i.Content.Contains(searchTerm) && i.ItemId.Equals(forcedPageId).Boost(5f));
        innerPredicate = innerPredicate.And(i => i.Content.Contains(searchTerm));

    var results = context.GetQueryable<SearchResultItem>()

Where the search term contains "download" we are searching on the term and "or"ing that with the same search also filtered by your pages ID and boosting that part of the search. So any results that contain that page ID should be boosted higher than other pages.

Please note - this is not tested and intended to give you a guide on how you might achieve this, the code is not production worthy ;)

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.