Joomla! 1.5's Search Components has some interesting new features plus a few things have moved around.
One of the many things you may notice about Version 1.5 is that Search now has it's own Administrator Component. You can access this by selecting Components -> Search from the menu. This replaces the previous location under Site -> Statistics -> Search Text in Version 1.0.
For a new install there's not much to see and if you had tried searching for something, nothing would be recorded. Let's fix that first.
Click the Parameters icon in the Toolbar. A dialog window will overlay the screen (you'll see this effect a lot in the Administrator) and will present you will a couple of Global Configuration parameters to set. At this stage we are only interested in the first one, so set Gather Search Statistics to Yes and then click Cancel or round X button at the top-right corner of the dialog box.
The Search Logging indicator will still show Disabled until you refresh the screen after which it should change to a nice, green Enable value.
Jump over to the frontend of your site and type something in the search box followed by clicking the Go button, or pressing Enter/Return (will vary depending on what template you have installed and how the search module is configured).
With luck you've selected a word that has some results (if you've installed the Sample Data "joomla" is a good guess). Most of this screen should be familiar to you except for one new line - the Search Areas. This set of checkboxes gives you the option of searching only within certain components. If you check the box next to Web Links, only results from the Web Links data will be returned in subsequent searches. If you leave all the boxes uncheck, Joomla! will assume that you just want to search everywhere.
Choose a few more words and try one or two a couple of times
Now jump back to the Search Component in the Administrator.
What you should see are all the words that you searched for and the number of times they have been requested. There is a link above the table which probably reads Show Search Results. If you click this links it toggles an extra column in the table. This column will give you a count of the number of search hits that you get for a given word or term. This is useful to look at from time to time because if you find that a word is being frequently searched, but the results are near zero then it may tell you something about what your visitors are looking for on your site.
It's a good idea to have a menu item for Search in one of your menus. It doesn't matter whether you tuck it away in a footer menu or let it be in a prominent position. If you don't include one, then the Search Component will only ever use the default parameters that are set internally. By including a menu item, and allowing Joomla! to find that (using the new Router) you will be able to override those settings if that is what you desire.
To add the Search Component to your menu, select Menus -> Main Menu (or any other menu you'd like).
Click New in the Toolbar.
On the next page, find and click Search under the Internal Links item in the tree that is displayed. You'll see Search / Search / Search in a tree. The first one is the Component name; the second one is the View name and the third one, which is a link, is the Layout name. Click on that last Search which is the link.
The next page is the edit form for the menu item. Enter a Title and Save.
If you now refresh your site you should see your new menu item displayed on your site.
The Search Component only has one View and only one Layout so it's very simple to customise.
To create a Layout Override for the Search Component, first look at your template folder. If you don't already have one, create a directory called html in your template directory. To create an override for a Component, the directory structure follow the format component_name / view_name / layout_file.php where the component _name and view_name must exactly match the directory names of the Component and the View, and the layout_file must also match the name of the layout file.
With that said, copy the file:
/components/com_search/views/search/tmpl/default.php
to
/templates/my_template/html/com_search/search/default.php
Now make a few changes in that file and refresh your site.
In a similar fashion, you can also override the Search Module layout file. Copy the file:
/modules/mod_search/tmpl/default.php
to
/templates/my_template/html/mod_search/default.php
Modules don't support views so our directory structure is not as deep as for a Component.
For more examples on Layout Override have a look at the html directory in the Beez template that ships with Joomla! 1.5.