How to search within a specific hubsite
-
08-02-2021 - |
Question
Using either Search Query tool or modern search WebParts (SPFx), is it possible to filter results from a specific hub site or site in a hub site ?
In the search query tool view all properties dialog, I don't see any managed property that suggest this is possible.
Solution
Ok, quite simply actually.
Thanks to this issue, I found that the DepartmentId
corresponds to the hub site.
So, this KQL filters on the hub site :
DepartmentId:"{24af7e54-d2f9-422d-a44e-6a6d40077d50}"
or (no more working)
DepartmentId:"{Site.ID}"
or (credits to @Alberto)
DepartmentId:{{PageContext.hubSiteId}}
if from a web-part.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange