I was not able to find the direct cause of this issue but I have found a possible solution.
When using the Like function with the slop parameter Like<T>(this T value, string phraseComparison, int slop), it formats the query correctly without the backslashes. From the logs: _content:("Test query Test test"~1)
I believe the phrase query is ...
The solution to this is to use the following function overload:
queryable = queryable.Where(p =>
((DateTime)p[(ObjectIndexerKey)"Date"]) > lastWeek.Boost(4f)
Note: The boost above does not appear to be translated in the query
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.
Sitecore was able to get back to me with a response on my ticket:
We have tested this with some sample code something like the following:
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item test = master.GetItem("/sitecore/content/MyTenant/MySite/Home/Test");
To filter suggestion result only particular path, there is three possible solutions:
Set contextField as _fullpath and pass path in ContextFilterQuery
using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())