Try our conversational search powered by Generative AI!

Page cms search not replaceing correctly

Vote:
 

Hi,

I have implemented my own cms search for pages, block and media. Blocks and media works like a charm but pages acts strange.

When I try to search for pages in the box above the pages tree I get no results. This is not that strange because the request url is EPiServer/shell/Stores/searchresults/?parameters=%7B%22filterOnDeleted%22%3Atrue%7D&filterOnCulture=false&searchRoots=1&providerId=EPiServer_Cms_Shell_Search_PageSearchProvider&searchQuery=test&dojo.preventCache=1464008940169

The key here is  “providerId=EPiServer_Cms_Shell_Search_PageSearchProvider&” T this tells me that epi is requesting the standard search instead of my implementation. The strange thing is that sometimes request the standard search and sometime my search and I can’t figure out why.

Any input will be most appreciated.

This is my implementation:

[SearchProvider]
public class CmsPageSearchProvider : ContentSearchProviderBase 
{
  public override IEnumerable Search(Query query)
        {
            //Search
        }   

public new string ToolTipResourceKeyBase
        {
            get { return ContentSearchProviderConstants.PageToolTipResourceKeyBase;}
        }

        public new string ToolTipContentTypeNameResourceKey
        {
            get { return ContentSearchProviderConstants.PageToolTipContentTypeNameResourceKey; }
        }

    public override string Area
        {
            get { return ContentSearchProviderConstants.PageArea; }
        }

        public override string Category
        {
            get { return LocalizationService.GetString(ContentSearchProviderConstants.PageCategory); }
        }

        protected override string IconCssClass
        {
            get {return ContentSearchProviderConstants.PageIconCssClass; }
        }
}

 

#148761
May 23, 2016 15:33
Vote:
 

Hi,

I implemented page search few times and had no problems, but I always used PageSearchProvider as base class. 

Search for pages is implemented with PageSearchProvider. The PageSearchProvider implements EPiServerSearchProviderBase<TContentData, TContentType> which implements ContentSearchProviderBase<PageData,PageType>.

Your implementation inherits directly from ContentSearchProviderBase<PageData,PageType>. So maybe some settings for pages are missing. 

You could try, for tests, inherit directly from PageSearchProvider:

 [SearchProvider]
    public class CmsPageSearchProvider : PageSearchProvider
    {
        public CmsPageSearchProvider(LocalizationService localizationService,
            SiteDefinitionResolver siteDefinitionResolver, PageTypeRepository pageTypeRepository,
            EditUrlResolver editUrlResolver, ServiceAccessor<SiteDefinition> currentSiteDefinition,
            IContentRepository contentRepository, ILanguageBranchRepository languageBranchRepository,
            SearchHandler searchHandler, ContentSearchHandler contentSearchHandler, SearchIndexConfig searchIndexConfig,
            UIDescriptorRegistry uiDescriptorRegistry, LanguageResolver languageResolver, UrlResolver urlResolver,
            TemplateResolver templateResolver)
            : base(
                localizationService, siteDefinitionResolver, pageTypeRepository, editUrlResolver, currentSiteDefinition,
                contentRepository, languageBranchRepository, searchHandler, contentSearchHandler, searchIndexConfig,
                uiDescriptorRegistry, languageResolver, urlResolver, templateResolver)
        {
        }

        public override IEnumerable<SearchResult> Search(Query query)
        {
            // Search
        }
    }
#148774
May 23, 2016 20:46
Vote:
 

Hi and thanks for your reply!

I tried and unfortunatly this did not solve the problem. I Even tried to do  x.For<PageSearchProvider>().Use<CmsPageSearchProvider>() in structuremap config and IIS reset.

#148791
May 24, 2016 11:37
Vote:
 

Ok so I found the answer to this one. Basically episerver registers all search providers including PageSearchProvider. These are then added to a list and sorted on a sort value that is set to 1000 by default. Implementing the interface ISortable located in Episerver.Framwork and setting the property SortOrder to 100 made my implementation beeing sorted before the standard implementations and thus beeing used in the cms search.

#149843
Jun 08, 2016 17:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.