Need help on SPFX web part properties search issue

Copper Contributor

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

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

 

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

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.

Hi

 

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

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.

Hey Guys, 

 

There is another more recent source to take a look at as well. Please have a look at this video from Vesa and Waldek: https://www.youtube.com/watch?v=iB8PBs8RH-E