Forum Discussion

sameersalunke1983's avatar
May 25, 2017

Need help on SPFX web part properties search issue

We need help on SharePoint SPFX implementation. We have created one sample web part and one description property in it.
When we are trying to search that property we are not able to search it.
We have tried adding this web part to classic and modern pages.
In Modern Page we found that it is crawling properties with webpart id + property content.
In Classic Page it is not searching.

We have added below code for making property searchable but it is not working.

protected get propertiesMetadata(): IWebPartPropertiesMetadata {
return {
'spfxcrawl' : {isHtmlString: true}
}
}

 

Thanks in advance.

6 Replies

  • Wictor Wilen's avatar
    Wictor Wilen
    Iron Contributor

    You need to add isSearchablePlainText the parameter to your return value:

     

    protected get propertiesMetadata(): IWebPartPropertiesMetadata {
        return {
          'spfxcrawl': { isSearchablePlainText: true }
        };
      }
    • Yannick Plenevaux's avatar
      Yannick Plenevaux
      Copper Contributor

      Hi

       

      isSearchablePlainText is not needed if isHtmlString is specified, both flag the property as searchable.

    • Thanks Wictor Wilen,

      We did this code changes also but then we found another issue guid of webpart always get padded with text which causes search.

      Also we have seen search will not work with classic pages. We got confirmation from MS team this SPFx web part content will not be searchable in classic pages due to existing search architecture for Classic Pages.

       

      Thanks for your reply.

      • Yannick Plenevaux's avatar
        Yannick Plenevaux
        Copper Contributor

        As Velin Georgiev says, the official reference doc might help you.

         

        It does mention that, indeed, SPFx WebPart properties metadata are not handled in classic pages.

         

        "Important: The following guide applies only to SharePoint Framework client-side web parts placed on modern SharePoint pages. Capabilities described in this article don't apply to classic web parts or SharePoint Framework client-side web parts placed on classic pages"

         

        Moreover, the content has to be crawled before appearing in search results. It might take several minutes.

  • Maybe this article can help: https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/integrate-web-part-properties-with-sharepoint

Resources