[Bug] Error in EPiServer.Find.Cms.CmsUnifiedSearchSetUp.GetVppFileUrl

Member since: 2007

Hi,


We're getting an error when searching for VPP files, please see stacktrace below:

EPiServer.Global System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: input
   at System.Text.RegularExpressions.Regex.IsMatch(String input)
   at EPiServer.UrlBuilder.Init(String url)
   at EPiServer.Find.Cms.CmsUnifiedSearchSetUp.GetVppFileUrl(String permanentLinkVirtualPath)
   at lambda_method(Closure )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at EPiServer.Find.ProjectionHelper.GetMappedSearchResultItem[TResult](SearchRequestBody requestBody, SearchHit`1 searchHit)
   at EPiServer.Find.ProjectionHelper.GetMappedResult[TResult](SearchRequestBody requestBody, SearchResults`1 jsonResult)
   at EPiServer.Find.SearchExtensions.GetProjectedResult[TResult](ISearch`1 search, SearchContext context)
   at EPiServer.Find.SearchExtensions.GetResult(ITypeSearch`1 search, HitSpecification hitSpecification, Boolean filterForPublicSearch)
   at NetR.Project.Templates.Search.Search.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.templates_search_search_aspx.ProcessRequest(HttpContext context) in c:\Users\johan.petersson\AppData\Local\Temp\Temporary ASP.NET Files\root\23475520\c9d7e24e\App_Web_2iidcopa.0.cs:line 0
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 - 1.2.5 Unhandled exception in ASP.NET
2013-04-23 11:02:42,179 DEBUG [] SearchSettings  - Start dequeue unprocessed items
2013-04-23 11:02:42,179 DEBUG [] SearchSettings  - End dequeue unprocessed items

 

We're using EPiServer 6 R2, PTB and Find 1.0.0.324.

My guess is that the problem is that we're using a EPiServer.Web.Hosting.VirtualPathNativeProvider for one of our VPPs.

#70554 Apr 23, 2013 11:13
  • Hi,

    I've registered the bug. You can however overload the default Url-projection for UnifiedFiles in UnifiedSearch by:

    SearchClient.Conventions.UnifiedSearchRegistry
                    .ForInstanceOf<UnifiedFile>()
                    .ProjectUrlFrom(x => x.GetUrl());
    
    public static string GetUrl(this UnifiedFile file)
    {
        if(file.PermanentLinkVirtualPath.IsNull())
        {
            return null;
        }
    
        if (Global.UrlRewriteProvider != null)
        {
            var url = new UrlBuilder(file.PermanentLinkVirtualPath);
            Global.UrlRewriteProvider.ConvertToExternal(url, null, UTF8Encoding.UTF8);
            return url.ToString();
        }
        
        return file.PermanentLinkVirtualPath;
    }
    #70607 Apr 24, 2013 9:53
  • Member since: 2007

    Thanks Henrik,


    I will try it out. We are not able to select Find as a product here http://world.episerver.com/en/Support/Register-Support-Incident/ when registering a new incident.

    #70689 Apr 26, 2013 10:44
  • Thanks for notifying us. I've requested that Find should be added.

    /Henrik

    #70690 Apr 26, 2013 10:58
  • Member since: 2007

    Hi again,


    That didn't actually solve the bug. Now all url's are null for files. But I'm just searching in my local EPiServer database, so I can rely on the url-rewriter when renderingen the url's.


    Now I'm just returning the VirtualPath and that works great.

    SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<UnifiedFile>()
        .ProjectUrlFrom<UnifiedFile>(file => file.VirtualPath));

        

    #70698 Apr 26, 2013 14:38