The official documentation states that this is broken.
Search result boosting works in Solr version 6.6 or earlier, but Solr changed the implementation in Solr 7, and later versions. Therefore, search result boosting is broken in Sitecore 9.1, 9.2, ...
Unfortunately, this doesn't work in Sitecore 9.3: https://doc.sitecore.com/en/developers/93/platform-administration-and-architecture/search-result-boosting.html
You can store the viewsCount in an indexed field and sort by it. Or move away from LINQ and directly query Solr.
This is achieved by imitating existing rules. Works as expected.
string storeVisited = CookieHelper.GetCookie("VisitedStore");
WhenFieldAndQueryStringMatches<RuleBoostingContext> ruleCondition = args.RuleCondition as WhenFieldAndQueryStringMatches<RuleBoostingContext>;
string operatorId = ruleCondition....
I'm not sure if I exactly known what you are trying to achieve but here are some details which might be helpful.
The BoostingService has two important methods:
IQueryable<ContentPage> BoostQuery(IList<Item> boostingItems, string searchQuery, Item contextItem, IQueryable<ContentPage> queryable)
IQueryable<ContentPage> BoostQuery(Field ...
Not all of them are static. Take a look at the whole list of supported boosting rules, in the end, you will find some SXA rules:
They are not dynamic as they are e.g.: comparing the field to the page field.
The other thing is that you can write your own rule is none of the existing suits your requirements. Check how SXA rules are written. There is an SXA ...