Try our conversational search powered by Generative AI!

Upgrading Dlls causes errors

Vote:
 

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

#91481
Oct 07, 2014 9:26
Vote:
 

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?

#91515
Oct 08, 2014 7:21
Vote:
 

Hi,

Can you post your entire query call?

/Henrik

#91524
Oct 08, 2014 9:09
Vote:
 

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();
#91525
Oct 08, 2014 9:42
Vote:
 

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

#91545
Edited, Oct 08, 2014 13:43
* 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.