Search Overview
Also see the search API.
A search form can be generated with one simple getContent. The search results are handled by the page detail getContent on the default template.
Seach covers the following modules:
- Sermons
- Articles
- Events
- Products & Families
- Blogs & Blog Posts
- Pages
- Songs & Playlists
- Media
- Books
- Small Groups
Search Index
We run a complete index once per day overnight. We also add any new content to the index every five minutes. If changes are made to existing documents, those will not appear until the complete re-index is run that night.
The following content from each record is used when creating the index:
- title
- summary
- content
- series
- categories
- authors/speakers
- tags
Regarding events: past events are included in the search index. To remove them, you will need to specifically delete or unpublish the event.
We use the sphinx search platform. This allows us to not only get the most accurate results possible, but to keep our database fast.
Search Form
The common search form.
Example
getContent("search", "display:box");
You can use 'show_results' to specify which content areas should be search. The following getContent will search for sermons and articles which are published.
getContent("search", "display:box","show_results:__sermonresults__ __articleresults__");
Search Results
There is no getContent needed to display the search results. By default the form will send users to /search-results/ which will use the default page template and display the results through the normal Page getContent.
If you would like to customize the results layout you can use a getContent to tweak the format as needed. If no show tags are used default output is returned. Here are a few examples:
A list grouped by type with pagination and output if no results are found.
getContent(
"search",
"display:results",
"groupby:module",
"before_show:<h1>__resultsnumber__ results for "__term__"",
"group_show:<h1>__title__ Results</h1>",
"show:<h3>__type__: __titlelink__</h3>",
"show:<p>Author: __author__</p>",
"show:<p>__preview__</p>",
"show:<p>Tags: __tags__</p>",
"after_show:<h1>__resultsnumber__ results for "__term__"</h1>",
"after_show:__pagination__",
"no_show:Sorry, your search for __term__ has no results."
);
A simple getContent, results will be returned based on relevance:
getContent(
"search",
"display:results",
"before_show:<h3>__resultsnumber__ results for "__term__"</h3>"
);
With Sermon displaying as 'Message':
getContent(
"search",
"display:results",
"Sermon:Message",
"no_show:Sorry, your search for __term__ has no results."
);
Will only match tags, not content and titles:
getContent(
"search",
"display:results",
"match:tags"
);
Will search all modules except media and blogs:
getContent(
"search",
"display:results",
"hide_module:media,blogs",
);
Will only search sermons and articles:
getContent(
"search",
"display:results",
"find_module:sermons,articles"
);