We are using the Search Form component on most of our nodes in our environment, but for some reason all of them are stuck using a community-level scope (searching the entire website) rather than limiting the scope to the category, board or group hub on which it resides, as expected her the documentation.
I've also tried explicitly setting the defaultToCommunity parameter to false as shown below, but still get search results from the entire website on said nodes.
<add to="search-bar">
<component id="common.widget.search-form" defaultToCommunity="false" hideGranularity="true"/>
</add>
Anybody experience this before and know what I should do? Because currently the search functionality on our nodes is pretty useless without a functional scope.
Edit: Community version is 20.11-release r2012100721 and search feature version is 3.3.
Solved! Go to Solution.
<div class="single-column margin-top-30 margin-bottom-30">
<@component id="common.widget.search-form" showAdvancedSearchLink="false" hideGranularity="false" />
</div>
This is what I am using on a page which reflects the following
Hi @jeffshurtliff Here is the doc for that specific component from the in-app docs in Studio. It looks like you're configuring it properly to me. Unless someone else comes up with an answer soon, I think you might be seeing a bug.
============================
You can configure the following in XLM View
XML Parameters
mode - Optimizes the component to use a wide or slim display. Possible values: slim, wide.
hideGranularity - Hides the drop-down list that scopes the search. When top-level categories are enabled on your community, you cannot hide granularity and also set defaultToCommunity to true. Possible values: true, false
defaultToCommunity - Defaults the scope of the search to be community-wide
searchType - Hides the granularity drop-down and scopes the search to messages or users. Possible values: message, user
A configuration like <component id="common.widget.search-form" hideGranularity="false" />
shows the dropdown and searches the current node by default.
A configuration like <component id="common.widget.search-form" hideGranularity="true" />
searches the entire top-level category.
Thanks @SuzieH @and @StanGromer!
I’m leaning toward it being a bug as well, because after seeing Stan’s post I decided to try toggling the value for hideGranularity (unhiding) it in one of my quilts for a TKB page and found that it caused the search bar to be scoped correctly.
So I believe that the bug is that when the hideGranularity parameter is set to “true” it forces the defaultToCommunity parameter to also be true even if it is explicitly set when calling the component in the quilt. (I haven’t tried calling the component within a custom component using the @component directive but I assume it acts the same.)
Just to partially close the loop on this topic, while it still appears to be a platform bug, we (@MohitVerman and I) were able to come up with a feasible workaround that we are now currently implementing globally in our environment.
We are updating all of our quilts that leverage the Search Form component (which is nearly all of them) to set the parameter hideGranularity=false rather than true, and then we're using CSS in our skin to hide the granularity filter in the components where we don't want it to display.
So far our tests have shown that this has successfully scoped the search results to the node in question and--in the case of categories or group hubs--any sub-nodes.
Welcome to the Technology board!
Curious about our platform? Looking to connect on social technology? You've come to the right place!