Try our conversational search powered by Generative AI!

EPiServer search super slow from the internal function (PopulateSearchResultsFromFeed)

Vote:
 

Our client reported the site search is very slow. After spending few hours & debugging into the EPiServer.ApplicationModules.dll, I found the most slowness is caused from the PopulateSearchResultsFromFeed private methods. 

From what I understand so far, the EPiServer search function takes the Lucene search expression and dynamically generate a search url to query the WCF service, then convert the result to the SearchResults object. The WCF service self only generates the SyndicationFeed. 

 

I' can confirm the MakeHttp request function is super fast, the performance issue seems come from Converting SyndicationFeed to SearchResults object.

 

private static SearchResults PopulateSearchResultsFromFeed(SyndicationFeed feed, int offset, int limit)
        {
            SearchResults results = new SearchResults();
            int num = 0;
            int.TryParse(GetAttributeValue(feed, SearchSettings.Config.SyndicationFeedAttributeNameTotalHits), ref num);
            string attributeValue = GetAttributeValue(feed, SearchSettings.Config.SyndicationFeedAttributeNameVersion);
            foreach (SyndicationItem item in feed.Items)
            {
                try
                {
                    System.DateTime time;
                    System.DateTime time2;
                    IndexResponseItem item2 = new IndexResponseItem(item.get_Id()) {
                        Title = (item.Title != null) ? item.Title.get_Text() : null,
                        DisplayText = (((TextSyndicationContent) item.Content) != null) ? ((TextSyndicationContent) item.Content).get_Text() : null,
                        Created = item.PublishDate.DateTime,
                        Modified = item.LastUpdatedTime.DateTime,
                        Uri = item.BaseUri,
                        Culture = GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameCulture),
                        ItemType = GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameType),
                        NamedIndex = GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameNamedIndex),
                        Metadata = GetElementValue(item, SearchSettings.Config.SyndicationItemElementNameMetadata)
                    };
                    if (System.DateTime.TryParse(GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNamePublicationEnd), System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeUniversal, ref time))
                    {
                        item2.PublicationEnd = new System.DateTime?(time);
                    }
                    if (System.DateTime.TryParse(GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNamePublicationStart), System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeUniversal, ref time2))
                    {
                        item2.PublicationStart = new System.DateTime?(time2);
                    }
                    float num2 = 1f;
                    item2.BoostFactor = float.TryParse(GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameBoostFactor), ref num2) ? num2 : ((float) 1f);
                    Uri uri = null;
                    item2.DataUri = Uri.TryCreate(GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameDataUri), UriKind.RelativeOrAbsolute, ref uri) ? uri : null;
                    float num3 = 0f;
                    item2.Score = float.TryParse(GetAttributeValue(item, SearchSettings.Config.SyndicationItemAttributeNameScore), ref num3) ? num3 : ((float) 0f);
                    AddAuthorsToIndexItem(item, item2);
                    AddCategoriesToIndexItem(item, item2);
                    AddACLToIndexItem(item, item2);
                    AddVirtualPathToIndexItem(item, item2);
                    if (SearchResultFilterHandler.Include(item2))
                    {
                        results.IndexResponseItems.Add(item2);
                    }
                }
                catch (System.Exception exception)
                {
                    SearchSettings.Log.Error(string.Format("Could not populate search results for syndication item with id '{0}'. Message: {1}{2}", item.get_Id(), exception.get_Message(), exception.get_StackTrace()));
                }
            }
            if (SearchSettings.Config.UseIndexingServicePaging)
            {
                results.TotalHits = num;
                results.Version = attributeValue;
                return results;
            }
            SearchResults results2 = new SearchResults {
                TotalHits = results.IndexResponseItems.get_Count()
            };
            foreach (IndexResponseItem item3 in Enumerable.Take<IndexResponseItem>(Enumerable.Skip<IndexResponseItem>(results.IndexResponseItems, offset), limit))
            {
                results2.IndexResponseItems.Add(item3);
            }
            results2.Version = attributeValue;
            return results2;
        }

    

Can EPiServer team help to have a look? It's really so annoying..

 

 

#75103
Sep 18, 2013 6:02
Vote:
 

BTW: the index size is only 5mb less and the search result only has 71 records, but it takes almost 8 to 10 seconds to return the value from SearchHandler search function.

#75117
Sep 18, 2013 10:23
Vote:
 

Any one experience the same issue?

#75188
Sep 19, 2013 16:12
Vote:
 

Can EPiServer team give a response for this issue? 

 

Thanks

#75592
Oct 01, 2013 3:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.