You can add a search box to allow visitors to search your site for a particular text string.
The search can encompass static site pages – including hidden and restricted pages – as well as dynamic content such as blogs, forums, events, and member profiles. The visitor can filter the search results – which are subject to the visitor's access permissions – and jump to any of the matching content.
From the site search settings, administrators can control whether events, member profiles, and hidden pages – those not included in your site menu – are included in the search results. By default, they are not included.
Search boxes – like other site content – are inserted as gadgets, in this case, a site search gadget. From the site search gadget's settings, you can control the appearance and behavior of the search box, and set the default content to be searched.
Setting up a site search box
Setting up a site search box involves adjusting the overall site search settings, adding a site search gadget, and adjusting the gadget's settings.
Site search settings
From the site search settings, you can control whether certain kinds of content are included in site search results.
To display the site search settings, hover over the Settings menu and select the Site option. From the list of site settings, click Site search settings.
The following settings are available:
|Search pages not in menu||Controls whether hidden pages – those not in your site menu – can be included in the search results. Menu pages are always included in search results depending on their access settings.|
Controls whether events can be included in the search results. If this option is disabled, then events will not be available as a default content option within the site search gadget settings.
|Search public member profiles||Controls whether members' public profiles can be included in the search results. If this option is disabled, then public member profiles will not be available as a default content option within the site search gadget settings. Even with this option enabled, individual member profiles can be excluded from search results by hiding them using member privacy settings.|
Adding a site search gadget
To add a search site box to a page on your site, follow these steps:
- Go to Sites pages (under the Website menu) and create or begin editing the page or page template where you want the search box to appear. Typically, search boxes are added to a page template so that it automatically appears on all pages that use the template.
- Click the Gadget icon to display the list of available gadgets.
- Drag the site search gadget from the list, and drop it where you want it to appear on the page. You can insert it into a section within a layout, above or below a layout, or above or below another gadget.
When a layout cell or placeholder is empty, a Drop gadget or layout here prompt will be displayed. When you begin dragging a gadget, possible destinations for the gadget appear blue. When you drag a gadget over an empty layout cell or placeholder, it turns green, indicating that you can drop the gadget there. When you drag a gadget above or below a layout or another gadget, a prompt will appear indicating that you can drop the gadget before or after the layout.
- After you have dropped the gadget in the desired location, hover your pointer over it and click the Settings icon.
- From the gadget settings panel on the left, choose the desired settings for your search box. For more information, see Site search gadget settings (below).
- Click Save to save the changes to the page or page template.
Site search gadget settings
From the site search gadget's settings, you can control the appearance and behavior of the search box.
To display these settings, hover over the gadget and click the Settings icon. The following settings are available for site search gadgets:
Limit default search to specific content types
|Controls the content types that are initially included in the search results. Visitors can enable or disable content types to filter the search results themselves. Events and member profiles will be included as options only if they are enabled within the site search settings (see above).|
|The text that is displayed within the search box before the visitor enters a search string.|
|Show suggested matches||Controls whether suggested matches are displayed within the search box.|
|Align||Controls whether the search box is left aligned, right aligned, or centered within the gadget.|
|Gadget title||If you specify a gadget title, the title will appear specially formatted within the gadget. Depending on the gadget style you choose, the title may appear in a heading box.|
|Gadget style||The gadget style determines the physical appearance of the gadget. The style you choose will determine the color and format of the gadget title, the gadget content, and the gadget border. You can choose from theme-specific styles and styles that are common to all themes.|
The amount of space – in pixels – that appears outside the gadget. You can set top, bottom, left, and right margins separately.
Within the Advanced section, you can enter CSS code or classes to further control the appearance and behavior of the gadget. For more information, see Advanced gadget settings.
Using a site search box
To search your site using a search box, visitors simply enter the search text in the box.
If the Show suggested matches option is enabled within the site search gadget settings , a list of possible matches will appear.
The visitor can click any of the suggested matches to jump to the corresponding content, or they can click the Search link at the bottom to view the full search results.
If you have disabled the Show suggested matches option, then the visitor can click the Enter or Return key to view the full results.
The search results will be sorted according to relevance. Icons are used to distinguish between the different kinds of content. Each result consists of an excerpt from the content, along with the date and author where applicable, and a link to the full content.
The results will be automatically restricted according to the access permissions and restrictions assigned to the content. The visitor can only search for content that they could otherwise view within your site. Hidden pages – those not included in your site menu – will only be returned if the Search pages not in menu option is enabled within the site search settings.
If the matching content was found in multiple locations, (e.g. forum summary, forum updates, and the forum post itself), the most detailed result will be returned (in this example, the full forum post).
Initially, the search will only be conducted within the content types enabled from the site search gadget settings. After the search results are displayed, the visitor can filter the results themselves by enabling or disabling different content types. To enable or disable content types, the visitor expands the Content type control by clicking on it, then checks or unchecks the various content types.
What gets searched?
Content to be searched
|Page contents||Content gadgets, gadget titles, identifiers, and descriptions. Page contents are searched according to the visitor's access permissions (e.g. if the visitor can't view a page, they can't search for it either). By default, hidden pages are not included in the search results, but this can be changed from the site search settings.|
|Blogs||Blog post title, content, and comments.|
|Forums||Forum topics, content, and replies.|
|Events||Event title, location, and description. Event tags are not searched. By default, events are not included in the search results, but this can be changed from the site search settings.|
|Member profiles||All contact fields, except rules and terms, date fields, and cost field values (field label is searched). By default, member profiles are not included in the search results, but this can be changed from the site search settings.|
- Search is performed on whole words only. Searching for "fon" won't find pages with the word "font". However, morphological searches are supported. For example, searching for "perform" will find pages with the word "performed".
- So-called stop words – and, or, the, etc. – within the search string are ignored.
- The autosuggestions include only pages with matching text in the page title, forum topic subject, blog post subject, event title, or member name. Full page search is available only in full search results.
- If a forum's permission is set to No access, but the page is accessible to a particular user, then links to the forum can appear in the search results, though clicking on them will generate an access denied error.
- When searching for events, the event title, details, and description are searched but not the event tags.
- New and updated pages have to be indexed before they can be searched. The indexing of your site takes place automatically in the background on a regular basis. You may have to wait several minutes before changes or additions to your site are reflected in the search results.