Tips & Tutorials

Adding Search to Your Site

clearFusionCMS is shipped with a search engine capable of searching content in all of the modules that are installed on your website, it then returns the results in a unified fashion to the searcher.

clearFusionCMS allows you to choose what items are indexed and which are not, you may choose not to index items in your gallery but index all the information in your news feeds.

To add search to your site:

  1. Create a document and call it search results, in the content area add [[!search.results]]
  2. Save the new document and record its document ID, in this example we'll assume the ID is 456
  3. Next add the snippet [[!search.form &resultsPage=`456`]] to your template(s) where you wish the search form to show, 456 will need to be replaced with the document ID from step 1
  4. Reload your site and there should now be a search box showing, entering a term in it will search all your documents and output the results to the search results page that was created in step 1

On initial installation the search will only search Documents for information, it will not search within additional modules until you enable it to do so.

  1. From the dashboard select Settings > Search > Search Fields
  2. For the Title search field select the fields from all the modules that you require to be indexed as titles
  3. For the content field, select all the fields from all the modules that you require to be indexed as content
  4. Click Update Search Fields
  5. At this point new content created will be indexed within the search, however existing content will not be included until the content has been reindexed
  6. Still under Settings, choose clearFusionCMS > Rebuild Search and click Reindex Content
  7. It can take from a few seconds to several minutes to index your sites content depending on how fast your hosting is and how much data you have.

Now when you perform a search all indexed content will be searched and results will be a mix from all of the content within the system.

You can give the searcher more control over what information is being searched by adding the &adv=`1` parameter to the [[!search.form]] snippet to enable advanced searches, this will allow searchers to limit their searches to just the fields they select e.g. search just within content titles.

You can add additional search fields from Settings > Search > Search Fields, for example you may choose to add a SKU field which only indexes the SKU of your products, doing so will allow your users to search on just the SKU ignoring the information contained within titles and other content.