SOLVED

Getting rich text from SPFx web parts into the search index

%3CLINGO-SUB%20id%3D%22lingo-sub-171137%22%20slang%3D%22en-US%22%3EGetting%20rich%20text%20from%20SPFx%20web%20parts%20into%20the%20search%20index%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-171137%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20used%20react-script-editor%2C%20react-textboxio%2C%20and%20react-tinymce%20from%20the%20samples%20folder%20in%20sp-dev-fx-webparts%20to%20add%20rich%20content%20to%20pages%2C%20but%20that%20rich%20content%20never%20gets%20added%20to%20the%20indexed%20text%20of%20the%20page%2C%20and%20consequently%20does%20not%20become%20searchable.%20In%20fact%2C%20none%20of%20the%20text%20in%20any%20non-stock%20webparts%20that%20I've%20seen%20ever%20gets%20put%20into%20the%20search%20index%20-%20only%20the%20built-in%20Microsoft%20webparts%20seem%20to%20do%20this.%3C%2FP%3E%0A%3CP%3EHow%20can%20I%20remedy%20this%3F%20If%20the%20built-in%20webparts%20are%20doing%20it%2C%20then%20there's%20obviously%20a%20way%2C%20yes%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-171940%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rich%20text%20from%20SPFx%20web%20parts%20into%20the%20search%20index%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-171940%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Franck%2C%20that%26nbsp%3Bworked!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-171419%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rich%20text%20from%20SPFx%20web%20parts%20into%20the%20search%20index%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-171419%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F74795%22%20target%3D%22_blank%22%3E%40Aaron%20Hawryluk%3C%2FA%3E.%20Actually%2C%20the%20content%20in%20the%20react-textboxio%20sample%20Web%20Part%20is%20indexed%20as%20an%20HTML%20string%20according%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fweb-parts%2Fguidance%2Fintegrate-web-part-properties-with-sharepoint%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Econfiguration%3C%2FA%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Eprotected%20get%20propertiesMetadata()%3A%20IWebPartPropertiesMetadata%20%7B%0A%20%20%20%20return%20%7B%0A%20%20%20%20'content'%20%3A%20%7BisHtmlString%3A%20true%7D%0A%20%20%20%20%7D%3B%0A%20%20%7D%3C%2FPRE%3E%0A%3CP%3EAs%20I%20remember%20and%20according%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-fx-webparts%2Fissues%2F102%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ethread%3C%2FA%3E%2C%20the%20content%20is%20indexed%20and%20then%20available%20trough%20the%20%22%3CSTRONG%3EDescription%3C%2FSTRONG%3E%22%20managed%20property%20so%20it%20is%26nbsp%3Bnot%20available%20trough%20the%20full%20text%20index.%20Can%20you%20check%20if%20you%20can%20get%20your%20content%20by%20querying%20this%20property%20explicitly%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFranck.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi there,

 

I've used react-script-editor, react-textboxio, and react-tinymce from the samples folder in sp-dev-fx-webparts to add rich content to pages, but that rich content never gets added to the indexed text of the page, and consequently does not become searchable. In fact, none of the text in any non-stock webparts that I've seen ever gets put into the search index - only the built-in Microsoft webparts seem to do this.

How can I remedy this? If the built-in webparts are doing it, then there's obviously a way, yes?

2 Replies
Highlighted
Solution

Hi @Aaron Hawryluk. Actually, the content in the react-textboxio sample Web Part is indexed as an HTML string according to this configuration:

 

 

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

As I remember and according to this thread, the content is indexed and then available trough the "Description" managed property so it is not available trough the full text index. Can you check if you can get your content by querying this property explicitly?

 

 

Franck.

 

Highlighted

Thanks Franck, that worked!