Tailor Global Search to Your Community
- Make more content searchable in your community.
- Set up the Search Results page.
- Configure autocomplete in the Search & Post Publisher.
Let's get started by turning on communities in your Trailhead Playground, if you haven’t already. Then we’ll create a community for Capricorn Coffee that you can use to follow along as we tour the features of community search.
Note: Once you enable Communities, you can't turn it off.
- From Setup, enter Communities Settings in Quick Find, then select Communities Settings.
- Select Enable Communities.
- Enter a unique value to be used as your domain name and click Check Availability. (Note: Keep in mind that you can't change the domain name after you save it. You have to call Salesforce to change it.)
- Click Save.
- Click OK.
You should have been redirected to the All Communities page in Setup, but if not, enter All Communities in Quick Find, and select All Communities.
- Click New Community.
- Select the Customer Service template.
- Click Get Started.
- For Name, enter Capricorn Cafe.
- If you’re asked for a URL, enter capricorncafe or another URL that’s not used for an existing community in your org.
- Click Create.
Take a quick look around. This is Experience Workspaces, where you have easy access to the Experience Builder and Dashboards, which we visit later.
If your search results are limited to Articles and Discussions, you might be using an older component for search results, called Search Results. It’s fine if you want to stick with that, but there are a few reasons to switch to the newer component, called Global Search Results. With it, you can:
- Make almost any object from your Salesforce org searchable in the community, including custom objects. You can even get results from external sources like Wikipedia. (We talk more about external sources in the next unit.)
- Turn on search results filtering, so users can refine their results and find exactly what they need.
- Add a search results overview page, called the All results tab, that lets users see a quick view of their best matches.
If that sounds like stuff your users would be excited about, read on. If you’re already using the Global Search Results component but want a refresher on its features, the rest of this section is for you as well.
To find your community’s search results component, head to the Experience Builder, open the Search template page, and click on the component.
- There are a few ways to get to the Experience Builder.
- If you created a new community using the steps above, you’re in Experience Workspaces.
Click the Builder tile.
- Community managers can select Experience Builder from their profile header when they’re logged in to the community.
- Salesforce administrators can reach the Experience Builder from
Setup. Enter All Communities in the Quick Find box, then select the
Builder link for the appropriate community.
- If you created a new community using the steps above, you’re in Experience Workspaces. Click the Builder tile.
- In the Pages menu, type Search in the Find a page box. Then select
Search under Template Pages.
- Hover the cursor over the search results section of the page. A blue border appears, and you can see the component name at the top. Click to open the component.
By default, the Global Search Results component shows results for Articles (if Knowledge is enabled), Discussions, Cases (for Service Cloud users), and Groups. But it’s easy to add any other object that’s searchable in Lightning Experience and supported in the Customer Service template. (To see which objects those are, check out the article in the Resources section called Compare Features Available in Community Templates.) You can make a custom object searchable, too, by creating a custom tab for the object in your Salesforce org.
Say you want community members to be able to search for PDFs and other files.
- At the bottom of the Global Search Results component, click Add. The first object from the list of available objects is added.
- To change it, click the object name to open its properties. Then, in the Object dropdown,
- Click Save.
After adding all the objects you want to be searchable, keep the Global Search Results component open to adjust how the objects appear in search results.
You might’ve noticed that you can drag and drop objects in the Global Search Results component to change their order. That’s the order that objects appear on the search results page. So if your community is strong on a certain type of information, like Articles, consider putting that object at the top.
You probably also noticed the two checkboxes:
- Show the All results tab
- Allow search result filtering
The All results tab gives your community members a place to see the top results for every object on one page. When users aren’t sure whether their answer is in a Discussion, an Article, or a File, seeing this overview can be a time-saver.
To see all results for an object, click the object name or View More.
If you select Allow search results filtering, your community members can narrow search results by selecting a supported object on the left side of the search results page and then applying filters.
Search filtering for communities is on by default in your Salesforce org. From Setup, in the Object Manager, go to Search Layouts for each object you want to filter. Add the fields that users want to filter to the Search Results layout. Supported field types are checkbox, phone number, picklist, text, and URL. You can’t filter encrypted fields.
If you have search results for Discussions, you can also decide how much information to show for each match. Capricorn Coffee selected “Show search results for all feeds, including questions, posts, and comments” to give its community members as many matches as possible for their search terms.
If you don’t check this box, only questions and answers that have topics are searched. Community members don’t see matches in Groups, feeds on records, or feeds on user profiles.
Something to consider when making your decision: When you check this box, the search results page also shows more information for each matching discussion.
Here are Capricorn’s Discussion search results with the box checked. Each result shows the title and text of the post, and the topics assigned to the post. This expanded format makes it easier for members to scan complete posts for information.
Here’s what Capricorn’s Discussion search results look like without the box checked. Note that the results don’t include any text from the post. This compact feed makes it easier to scan titles of posts.
If it’s more important for your community that Discussion results are compact, leave this box unchecked.
To see how great your new search results page looks, enter a test word in the Search Term field of Global Search Results component, then press Enter. (If you’re following along in a new Trailhead Playground, you might not see many—or any—search results for this test.)
When you’re satisfied with how your search results look, click Publish in the community header.
Let’s back up a tiny bit and talk about what happens even before your community members get to the search results page. In communities, they can also get search results as they type in the search box.
We invite you to meet the Global Search for Peer-to-Peer Communities component, where you can set up a feature called autocomplete. When community members start typing their search terms in the search box, autocomplete suggests matching articles, discussions, and more. It’s kind of like having a friend who finishes your sentences for you—in a helpful way. It helps users get to what they’re looking for faster.
The Global Search for Peer-to-Peer Communities component is in the Experience Builder. To open it, hover the cursor over the search box at the top of the page and click when the blue border appears. To get started, expand the Autocomplete Search section.
As you can see, there’s a lot here about autocomplete. Let’s go through it step by step.
The first checkbox is easy: Use it to turn on autocomplete. It might even already be checked. Nice work!
For the rest, let’s simplify things. Let’s talk about what Capricorn Coffee did for its community. Think of it as ordering the Barista’s Special.
- Maximum Autocomplete Results
- Decide how many results you want to appear as the user types. Capricorn kept the default of 6. Too many results can be overwhelming, and with the most relevant ones at the top, there’s no need to go too wild here.
- Limit Autocomplete Search Results to Discussions and Articles
- Capricorn wants community members to see results for other objects, too, so this was left unchecked.
- Objects in Autocomplete Results
- Just like it added Files to the Global Search Results component, Capricorn added Files
That’s it! It’s easy like a Sunday morning drip coffee.
If your community uses the Search & Post Publisher component, you have two options.
- Upgrade to the Winter ’18 Napili template, which uses the Global Search for Peer-to-Peer Communities component. Keep in mind that the new template includes other changes that you may want to consider before updating.
- Keep reading to set up the Search & Post Publisher according to best practices.
To set up the Search & Post Publisher, go to the Builder and click the search box.
Check the box to use autocomplete in searches. Then:
- Show Autocomplete Results in One List (1)
- Check this box so your community members see all the matches for their search terms in one place. Mousing around to different tabs is more work, and can be difficult for community members with limited mobility.
- Result Sorting (2)
- Sort by Relevance. This setting has more to it than meets the eye. Not only does it put the most relevant results at the top of the list, it also allows you to add more objects to autocomplete. By contrast, the Group by Object option limits autocomplete results to Articles and Discussions.
- Maximum Autocomplete Results (3)
- We suggest using no more than 10.
- Autocomplete Results (4)
- Sort by Relevance. Here’s where you can add objects to be searched by autocomplete. Click
Add, then click the new object to change it in the Result Properties.
Click Save, and you’re good to go.
You might wonder how we determine which autocomplete results are most relevant. We put Discussions and Articles at the top of the list, and we pay attention to how many views and likes an article has, and whether any community members chose an answer as a best answer or gave it a thumbs-up rating.
The rest of the results are ordered based on factors we discussed in the last unit.
When you’re finished editing in the Search & Post Publisher, click Publish in the community header.
Next, we discuss some additional search features you can set up in your community.