November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
My guess is that you need to move the ApplyBestBets() so that your query is of IQueriedSearch type.
How does your query look at the moment?
Hi, thanks for looking into this for us - I have posted the code below:
SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add();
client.Conventions.UnifiedSearchRegistry
.ForInstanceOf()
.ProjectTitleFrom(x => x.Title);
//Create a search/query for the entered search text retrieved from the query string.
EPiServer.Find.IQueriedSearch query = SearchClient.Instance.UnifiedSearchFor(Query);
try
{
if (CurrentBlock.UseAndForMultipleSearchTerms)
{
var queryStringQuery = (IQueriedSearch)query;
query = queryStringQuery.WithAndAsDefaultOperator();
}
}
catch
{
}
//Include a facet for sections.
query = query.TermsFacetFor(x => x.SearchCategories, Facet => Facet.Size = 50)
.FilterFacet("AllSections", x =>
x.SearchTitle.Exists()
| !x.SearchTitle.Exists())
.Filter(x => x.MatchType(typeof(EPiServer.Templates.RCOG.Models.Pages.NewsArticleType)))
.Take(PageSize)
.ApplyBestBets();
Is it correct to assume that the code included above originally said "var query" rather than "EPiServer.Find.IQueriedSearch query"?
If you were to change the declaration of the query variable to:
EPiServer.Find.ITypeSearch<ISearchContent> query = SearchClient.Instance.UnifiedSearchFor(Query);
that last reassignment of the query variable should be ok in 8.2 as well as later versions.
It's worth noting that an IQueriedSearch is an ITypeSearch, so it's really only the actual re-assignment of the query variable that is problematic, the sequence of extension method calls should be fine.
The change was made a few versions back as part of a fix of an inconsistency with the CMS variation of the UnifiedSearchFor extension and while that solved other problems it was an oversight that it was included without proper notification.
We're sorry about any problems caused by this!
Edit: The generic type was missing
Hi,
I have recently updated my packages from find.framework 8.2 to 8.7 and a lot of my code falls over such ApplyBestBets() now throws an error -
Error 205 Cannot implicitly convert type 'EPiServer.Find.ITypeSearch' to 'EPiServer.Find.IQueriedSearch'. An explicit conversion exists (are you missing a cast?)
. Have I missed anything?
I have updated the other packages to their latset versions too.
Jon