5 February 2018 | 272 views
The search functionality is fairly simple and handled by searchContent() in the base TfSearchContent class. Search functionality is offered on search.php and also on error.php which is the custom 404 error page.
If multiple search terms are entered a drop down allows the results to be filtered by:
- All (AND)
- Any (OR)
- Exact match
TfSearchContent allows a limit and offset and the search type to be specified for search results using setLimit(int $limit) and setOffset(int $offset). If not specified the default limit is that set in the Search pagination of site preferences and the default operator is AND.
Search terms are subject to a minimum length check, which is set by Min. search length in site preferences. Search terms that are shorter than the minimum length requirements (default value 3) are discarded, to prevent overloading the system. Search terms are escaped for use in the database query through use of prepared statements with named placeholders / bound values.
Copyright, all rights reserved.