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 control the searchable content of your sites using Site Index Entries - and we provide a Site Index Builder so you can create entries with just a few clicks. We also provide a custom @BRT Helper and code snippets that let you build a Search Results page in less than a minute.
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 - documented here.
Pages designed to present dynamic content, such as news articles, require a site index entry to make the dynamic content searchable.
To create Site Index Entries:
The Site Indexes screen displays existing site index entries. If no entries have been created use the Site Index Builder to quickly index the most important pages on your sites.
The Site Index Builder creates a list of all the pages on a site that include @BRTDetail(), @BRTLister(), and @BRTIndex() - the helpers used to present dynamic content lists and details pages.
These are the most important pages to index - especially pages containing @BRTDetail().
The site builder does not display pages that already have an index entry.
Click the button.
1 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.
2 The GoToPage button displays the page in a separate tab or window.
3 Click the show link to display the page code containing the helper.
4 Click the Create button to create an active index for the page
5 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
6 Click the Return link to return to the Site Indexes Screen
From the Site Index Screen, click the button to create a new entry (it's much easier to use the builder. The Site Index Builder button is below the entries list. ) Click any existing entry to open it for editing.
1 Save changes, Return to the previous screen, use the Actions button to Delete the entry or display the history of edits to the entry. Enter a field name in the Jump To to go to that field.
2 the name of the Page being indexed
3 the friendly name (URL) of the Page
4 the name of the table storing the record(s) that populate the page. Either Content or Contacts.
5 the name of the View that is referenced by @BRT helpers on the page
6 an XML filter statement to add limits to the content returned by the search
7 enter one or more saved filters for the designated View to add limits to the content returned by the search
8 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.
9 the status of the entry. This is either Active, Inactive, or Dismissed
10 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.)
Creating a Search results page simply requires adding a few lines of code to a page source. When the page loads with an HTML querystring providing search terms - the @BRTSearchResultsScript() helper renders a list of content containing the search terms.
The HTML querystring should provide search terms in the format: q=search term or terms.
For example: www.website.com\searchresults?q=brick river
Code samples below demonstrate a few simple form fields for launching search results pages with the required query string.
In the following example we created the Search Results page (with a friendly URL of "searchresults")
This page includes:
1 Optional - 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 querystring when the form is submitted.
2 Required - an empty <div> with an id="results" and the custom helper: @BRT.SearchResultsScript().
You can insert this code automatically - place the cursor in the editable Source area, click the button to display 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.
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.
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".
<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>