Configuring the Search Engine for your Website(s)
Search Engine and Site Index
Brick River includes a built-in search engine that has several advantages over third-party embedded search tools (such as Google Custom Search Engine). You can control the searchable content of your sites using site index entries. We provide a site index builder so that you can create entries with just a few clicks. We also provide a custom @BRT helper and code snippets that let you build search results page in less than a minute.
Step 1- Create Site Index Entries
You should carefully consider which pages and content you wish to be searchable and create indexes for the pages that display this content. By default, the static text on any published page is searchable. A site index entry is not required. If you wish to exclude a page from searches, check the Hide in Sitemap box in the page properties. Pages designed to present dynamic content, such as news articles, require a site index entry to make the dynamic content searchable.
- On the top menu, click Site->My Site Indexes. The Site Indexes screen displays existing site index entries.
- Click Site Index Builder. The site index builder creates a list of all the pages on a site that includes @BRTDetail(), @BRTLister(), and @BRTIndex() - the helpers used to present dynamic content lists and details pages. These are the most important pages to have an index - especially pages containing @BRTDetail(). The site builder does not display pages that already have an index entry.
- Choose a site: Select the site for which you are creating entries. The builder displays pages containing the target helpers. Pages containing @BRTDetail() are highlighted in green - these pages are usually the most important pages to index.
- GoToPage button: This displays the page in a separate tab or window.
- Show: Click the show link to display the page code containing the helper.
- Create: Click the Create button to create an active index for the page.
- Dismiss: Click the Dismiss button to exclude the page from searches. A page with Dismiss status will not be included when the site builder is used in the future.
- Return: Click the Return link to return to the site indexes screen.
Step 2 - Create/Manage New Site Index Entries
On the Site Index Screen, click New to create a new entry or click an existing entry to edit it.
- Save, Return, Actions, Activity, Jump To: You can perform various activities using these buttons such as saving the work, return to the previous screen, delete the entry using the actions button or viewing the activity. Enter a field name in the Jump To to go to that field.
- Name: Enter the name of the Page being indexed
- Friendly: Enter the friendly name (URL) of the Page.
- TableId: Enter the name of the table storing the record(s) that populate the page. Either Content or Contacts.
- ViewId: The name of the View that is referenced by @BRT helpers on the page
- Condition: Add an XML filter statement to add limits to the content returned by the search
- Filters: Enter one or more saved filters for the designated View to add limits to the content returned by the search
- Append Href to Friendly: Append a record ID to the URL the search engine will create to navigate to search result pages. Choose YES for pages that use the @BRTDetail(), helper, to display content.
- Status: Select the status of the entry. This is either Active, Inactive, or Dismissed.
- Active entries are currently included in the site index
- Inactive entries are currently excluded. You may want to exclude content from a search temporarily. It's easier to toggle the active status than to delete and re-create entries.
- Dismissed entries are excluded - and will not appear in the site builder. If you have a site with lots of pages that should not be searched - this is a way to prevent them from showing up in the builder.
- Websites: The website(s) to be searched. If you maintain multiple sites that use pages of the same name - you can create an index entry to search for content across multiple sites. (For example, let's say that you have five sites for five different youth camps and each site has a News Details page. You can create a news search index to return results from all five sites.)
Step 3 - Create a Search Results Page
- On the top menu, click Site->Demo. The demo is the name of the sample website.
- Select a page, right-click on it, and click Edit. A new window showing all the content on the page is displayed.
- Click Source. This opens the editor where you can add your code.
- Optional: This page includes a simple form to include a Search field at the top of the page, the name and value parameters load the page with the necessary query string when the form is submitted.
- Required: an empty <div> with an id="results" and the custom helper: @BRT.SearchResultsScript().
- You can insert this code automatically or you can use the snippets. Place your cursor in the editable source area and click Snippets. This displays a list of available snippets.
- Select Search Results to paste the required <div> and helper, or Search Form and Results to include the optional Search field form.
- Click Save to save the changes. A search performed on the page yields the number of hits, buttons to filter by the type of content found, and links to the content.
Step 4 - Add a Search Form to Site Pages
It's likely that you will want to display a Search form on each page of a website. The following code example can be placed in a layout used by site pages to add a Search button to a Navbar or Header area. Note the parameters action="searchresults" and name="q".
<code> <form class="form-inline my-2 my-lg-0"> <button class="btn btn-sm btn-outline-danger my-2 my-sm-0" id="searchopener" type="button"><i class="fa fa-search" aria-hidden="true"></i></button> </form> <div id="searchdiv" style="display:none;"> <form id="cse-search-box" action="/searchresults"> <div class="input-group"> <input type="text" name="q" class="form-control" id="searchbox" /> <span class="input-group-btn"> <button type="submit" class="btn btn-danger" id="searchbutton">Search</button> </span> </div> </form> </div>