SPFx react-search-refiners webpart | No results from teamsites displayed

%3CLINGO-SUB%20id%3D%22lingo-sub-310452%22%20slang%3D%22en-US%22%3ESPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310452%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20using%20the%20SPFx%20SPFx%20react-search-refiners%20webpart%20and%20I%20don't%20know%20if%20this%20is%20a%20bug%20or%20this%20is%20due%20to%20SharePoint%20restrictions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20enter%20a%20KQL%20query%20I%20supose%20to%20get%20the%20same%20results%20as%20I%20use%20the%20query%20in%20the%20search%20box%20or%20in%20the%20SharePoint%20Search%20Query%20Tool.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20hub%20site%20(SharePoint%20Communication%20Site)%20with%20several%20group%20connected%20Teamsites%20connected%20to%20this%20hub%20site.%20When%20I%20enter%20the%20following%20query%3CBR%20%2F%3E%3CSTRONG%3EPath%3A%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2Fteams%2F*%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2Fteams%2F*%3C%2FA%3Econtentclass%3ASTS_Site%20SiteTemplate%3AGROUP%3C%2FSTRONG%3E%3CBR%20%2F%3Ein%20the%20Query%20Template%20box%20no%20results%20are%20returned.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBut%20when%20I%20enter%20this%20same%20query%20in%20i.e.%20the%20SharePoint%20Searchbox%20I%20get%20a%20list%20of%20the%20teamsites%20back.%3CBR%20%2F%3EAnd%20when%20I%20add%20this%20same%20query%20in%20the%20SharePoint%20Search%20Query%20tool%20I%20also%20get%20the%20right%20results%20back.%3CBR%20%2F%3ESome%20Teamsites%20are%20private%20and%20some%20are%20public%2C%20and%20I'm%20Owner%20of%20all%20sites.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3ESteps%20to%20Reproduce%3A%3C%2FEM%3E%3C%2FP%3E%3COL%3E%3CLI%3ECreate%20new%20Communication%20Site%3C%2FLI%3E%3CLI%3EMake%20this%20site%20a%20hub%20site%3C%2FLI%3E%3CLI%3ECreate%20several%20teamsites%3C%2FLI%3E%3CLI%3EConnect%20them%20to%20the%20hubsites%3C%2FLI%3E%3CLI%3EAdd%20the%20webpart%20to%20the%20startpage%20of%20the%20hub%3C%2FLI%3E%3CLI%3EConfigure%20webpart%3A%3CUL%3E%3CLI%3ESearch%20Query%20Keywords%20%3D%20*%3C%2FLI%3E%3CLI%3EQuery%20Template%20%3D%3CBR%20%2F%3EPath%3A%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2Fteams%2F*%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2Fteams%2F*%3C%2FA%3Econtentclass%3ASTS_Site%20SiteTemplate%3AGROUP%3C%2FLI%3E%3CLI%3ENo%20further%20Changes%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EIs%20this%20a%20bug%20or%20is%20this%20due%20to%20SharePoint%20restrictions%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-310452%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312303%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312303%22%20slang%3D%22en-US%22%3E%3CP%3EDone!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-fx-webparts%2Fissues%2F749%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-fx-webparts%2Fissues%2F749%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312291%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312291%22%20slang%3D%22en-US%22%3E%3CP%3EGreat!%3C%2FP%3E%3CP%3EThis%20change%20should%20be%26nbsp%3Bcommitted%26nbsp%3Bto%20the%20community%20repository%20also.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312277%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312277%22%20slang%3D%22en-US%22%3E%3CP%3EI%20added%20the%20following%20lines%20of%20code%20to%20the%20SearchServices.ts%20file%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EsearchQuery%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3EProperties%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%5B%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%3CSPAN%3EName%3A%3C%2FSPAN%3E%3CSPAN%3E%22EnableDynamicGroups%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%3CSPAN%3EValue%3A%3C%2FSPAN%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CSPAN%3EBoolVal%3A%3C%2FSPAN%3E%3CSPAN%3Etrue%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CSPAN%3EQueryPropertyValueTypeIndex%3A%3C%2FSPAN%3E%3CSPAN%3E3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%5D%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EAnd%20it%20is%20working%20now.%20Thanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F5628%22%20target%3D%22_blank%22%3E%40Matti%20Paukkonen%3C%2FA%3Efor%20pointing%20me%20in%20the%20right%20direction.%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312203%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312203%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20information.%20I'm%20will%20check%20the%26nbsp%3BEnableDynamicGroups%20property.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312188%22%20slang%3D%22en-US%22%3ERe%3A%20SPFx%20react-search-refiners%20webpart%20%7C%20No%20results%20from%20teamsites%20displayed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312188%22%20slang%3D%22en-US%22%3E%3CP%3EAre%20Groups%20you%20are%20searching%20for%20set%20as%20%22Private%22%3F%20By%20default%20Search%20REST%20API%20is%20not%20including%20Private%20Groups%20on%20search%20results.%3C%2FP%3E%3CP%3EWeb%20Part%20is%20not%20including%20EnableDynamicGroups%20property%20on%20search%20query.%20So%20it%20is%20not%20a%20bug%2C%20it's%20just%20feature%20missing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I'm using the SPFx SPFx react-search-refiners webpart and I don't know if this is a bug or this is due to SharePoint restrictions.

 

When I enter a KQL query I supose to get the same results as I use the query in the search box or in the SharePoint Search Query Tool.

 

I have a hub site (SharePoint Communication Site) with several group connected Teamsites connected to this hub site. When I enter the following query
Path:https://tenant.sharepoint.com/teams/* contentclass:STS_Site SiteTemplate:GROUP
in the Query Template box no results are returned.


But when I enter this same query in i.e. the SharePoint Searchbox I get a list of the teamsites back.
And when I add this same query in the SharePoint Search Query tool I also get the right results back.
Some Teamsites are private and some are public, and I'm Owner of all sites.

 

Steps to Reproduce:

  1. Create new Communication Site
  2. Make this site a hub site
  3. Create several teamsites
  4. Connect them to the hubsites
  5. Add the webpart to the startpage of the hub
  6. Configure webpart:

Is this a bug or is this due to SharePoint restrictions?

5 Replies
Highlighted

Are Groups you are searching for set as "Private"? By default Search REST API is not including Private Groups on search results.

Web Part is not including EnableDynamicGroups property on search query. So it is not a bug, it's just feature missing.

 

 

 

Highlighted

Thanks for the information. I'm will check the EnableDynamicGroups property.

Highlighted

I added the following lines of code to the SearchServices.ts file:

searchQuery.Properties = [{
    Name: "EnableDynamicGroups",
    Value: {
        BoolVal: true,
        QueryPropertyValueTypeIndex: 3
    }
}]
 
And it is working now. Thanks @Matti Paukkonen for pointing me in the right direction.
Highlighted

Great!

This change should be committed to the community repository also.