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
- Members
- Blogs
- Pages
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"
);