ocPortal Tutorial: Searching your website
Written by Allen Ellis, ocProductsAs you add content to your website, it becomes increasingly important that your visitors are able to find your content when they need to. ocPortal includes a 'search' feature, which allows you to search your entire website for content.
Table of contents
- ocPortal Tutorial: Searching your website
The search block
Detailed searchesIf you would like to carry out detailed searches, there is a 'More' button in the search content block. Clicking this will bring you to the main search screen, which has several options:
Boolean SearchChoosing to do a boolean search will make several more options available:
- Content must contain all of these words
- Content must contain one or more of these words
After selecting 'Boolean search', you also gain the several searching possibilities, that you may activate as follows:
- Put speech marks around words that you would like to occur in sequence
- Put a '-' before a word to shun it
- Put a '+' before a word to require it.
Search only titlesWith this option checked, ocPortal will only search titles of content.
Author/SubmitterIn this field, you can type the name of a member on the website. If you do this, ocPortal will only look for entries that this person has submitted. It also matches against author names.
Submitted within the previousIn this field, you can set a cut-off date, to not show entries that are older.
Sort byIn this field, you can specify what order you would like your results shown in.
Search the following content typesPlacing a checkmark beside each content type will cause ocPortal to search for entries in these content types. Clearing the checkbox will cause ocPortal not to search in these locations.
Google searchThe Google search will carry out a search of the site using the index of the Google search engine. Upon filling in this separate form you will be redirected to a Google results page (the Google search is commented-out of the search templates by default, as the ocPortal search engine can search with more control and understands the data better).
Performing an advanced search for a specific content type
Searching from the Forum
The search button on the forum
To initiate a search while in the forum (our own OCF forum), you need to click the 'Search' button on the forum or use the contextual search box on the forum member bar. The contextual search will search beneath your current forum if you are on a forum-view screen, or within your current topic if you are on a topic-view screen.
OpenSearchocPortal can support OpenSearch, which allows your users to search your website from directly within their web browser (currently available in Firefox and Internet Explorer). It also supports 'Google Suggest' style search suggestions, based on past searches performed.
By default OpenSearch is configured (via the HTML_HEAD template) to only be active within a zone named 'docs' and for it to only search Comcode pages. You can, however, configure it to perform any search types you like via changing the code used in this template. You should make sure you have a 'favicon' before enabling OpenSearch, as it is important the web browser has one of these available to use.
Improving search resultsThe title fields, and meta keyword fields, get precedence when search results are determined. Tuning these manually for your can improve search results considerably.
If you are using MySQL, also considering turning the MySQL minimum word length down to 3 (the default 4).
MySQLUltimately, full-text search effectiveness resides in MySQL (or whatever database you use), not ocPortal. For example, indexing does not work on very small words, very common words, and may split things up you did not expect to be (e.g. an-example would split to two words).
True boolean search is much more accurate, but also much slower due to a lack of indexing. ocPortal will only use true boolean search if boolean search is selected and it thinks MySQL's fulltext-based boolean search won't be able to handle the query itself (e.g. due to using short words). Programmers can alter this logic based on editing the is_under_radar function.