Documentation for the worlds leading Java Based Open Source Web Content Management System

dotCMS

Site Search

CMSAdmin-SiteSearch

Under the CMS Admin tab, the back end site search page is available for webmasters to schedule and control site indexation for one or more hosts.

There are a few important server things to consider when indexing a site for search

  • The name of your host(not aliases) must resolve locally on your server. Edit your host file if needed here.
  • If running on Windows you need CYGWIN. The dotCMS exe installs CYGWIN for you but the zip and svn do not. You only need a basic install of CYGWIN.

The following steps illustrate how to enable/schedule site indexation to allow site searching on all hosts to return speedy results to front end users.

  • As show below, a separate site indexation can be scheduled for each host or a single job can be scheduled to index all hosts.
  • SetIndexationSchedule
  • The port matching your tomcat server.xml must be declared and a cron job expression can be set to schedule future re-indexation jobs.
  • Optionally, certain paths and/or specified file type extensions can be declared so that they are ignored and do NOT become part of the site indexation.
  • For a very granular site indexation of url paths which are partially constructed from dymamic query results on pages, click the "Follow Query Strings" checkbox.
  • *Finally, click save to set the cron job to execute later at the specified schedule time, or click "Save & Execute" to set the cron job schedule AND run an imediate site indexation based on your specified parameters.

So once my site is indexed, how do I enable site seaching on my webpages?

The home page of the starter site has a search feature already created for you as an example.

HomepageSearch

There is a form action in the page Header container included in the starter that sets a search parameter value and directs a search request to a search detail page


<form action="/home/search-results.dot" method="get"/> 
<input type="text" value="Search" name="dotQ" onfocus="this.value='';" />
SearchDetailPage

The search detail page takes the parameter from the URL (shown below)

# set($q = $request.getParameter("dotQ")

and then searches for matches in the site index.  You can preview the widget code on the starter site on the /home/search-results.dot webpage.

*Before running a site index, you must make sure that all hosts you are indexing are actually reachable on the declared port number, if not, you will get errors on the dotCMS log and your site indexation will fail.

2

Subscribe to dotcms

Visit this group