Creating Interaction in Joomla: Using the Basic Keyword Search

The basic keyword search, which is provided by the Joomla Search component, is supported by a variety of plug-ins. The search box that you see on the site provides the basic search facility. This search technique is much slower when compared with indexed search, and it is limited to searching the articles and the selected items that are specified while configuring the plug-ins. As discussed earlier, this type of searching is preferred only for small sites.

Following are two ways to use the Search component:

  • Publish the Search module.
  • Link to the menu item type named Search Form or Search Results.

Let’s begin with publishing the Search module. Joomla includes two search modules, one for each search component:

  • Search module for the Search component
  • Smart Search module for the Smart Search component

Both modules are the same, except that the Smart Search module also displays an Advanced Search link. Open the Module Manager to list the modules. If you find the Search module in an unpublished state (see Figure 6-15), click the red x status button to publish it.

Click the Status button; the Search module will open in edit mode, as shown in Figure 6-16. You can use the fields displayed on this page to configure the search module.

The fields are described in the following list:

  • Title: Displays the module title.
  • Box Label: Enter the text that you want to appear in the label of the search box.
  • Box Width: Determines the size of the search text box in Default value is 20.
  • Box Text: Enter the text that you want to appear in the search text The text guides the user and gets overwritten when the user types something in this box.
  • Search Button: Select Yes to display a Search button.
  • Button Position: Determines the position of the Search button in relation to the search Valid options are Right, Left, Top, and Bottom.
  • Search Button Image: Select Yes if you want to use an image as a The image has to be placed in the templates/*your template name*/images/ folder with the name searchButton.gif.
  • Button Text: Enter the text that you want to appear in the search The default text is Search.
  • OpenSearch autodiscovery: If your browser supports OpenSearch, select Yes to add support for your site’s search.
  • OpenSearch title: If your browser supports OpenSearch, enter the text in this field that is displayed when your site is added as a search provider.
  • Set ItemID: From the combo box, assign an ItemID by selecting a menu item for displaying the search results.
  • Show Title: Select the Show option to display the module’s title on the web site.
  • Module Position: From the combo box, choose the position on the web site where you want the module to appear.
  • Status: From the combo box, choose the Published option to publish the Two other options are Unpublished and Trashed.
  • Start Publishing: Choose date and time to publish the module automatically in the future.
  • Finish Publishing: Choose date and time to unpublish the module automatically in the future.
  • Access: From the combo box, choose the access level of this The default access level is Public, which makes the module visible to all visitors.
  • Ordering: Displays the ordering of all the modules, including the position of the current module in the front end.
  • Language: From the Language combo box, select the language of the module. If you are creating a multilingual site and want to show search results in any specific language, choose it from this combo box. Meanwhile, leave the default value of All for this field.
  • Note: In this optional field, you can write a reminder note for this search Leave it blank for now.

After configuring the Search module, click the Save & Close button to save the changes and exit. The next step is to enable the search plug-ins by selecting Extensions ➤ Plugin Manager (see the screen shown in Figure 6-17).

From the list of plug-ins, enable any that are disabled:

  • Search — Categories: Enables category searching on your site
  • Search — Contacts: Enables searching of Contacts component content
  • Search — Content: Enables article searching
  • Search Newsfeeds: Enables searching of Newsfeed component content
  • Search Weblinks: Enables searching of Weblinks component content
  • Search — Tags: Enables tag searching

Your Search component is active, and it is time to check it. Open the browser and then open the front end of the site (by pointing the browser at the address http://localhost/joomlasite). Let’s search for the text camera in the site, so write camera in the search box at the top, followed by clicking the Search button. The search result will appear as shown in Figure 6-18. To constraint your search to the limited content, you can select the checkboxes for Categories, Contacts, Articles, Newsfeeds, and so on under the Search Only heading.

The second way to use the Search component is to create a menu item and link it to the search page. Open the Administrator interface and select Menus ➤ Menu Manager from the menu bar. You’ll see a list of all the existing menus. Click the New icon to create a new menu item. You’ll see a screen that lets you enter the information for the menu item. Enter the information shown in Figure 6-19.

The title you want to appear for the menu item is Searching, so enter it in the Menu Title field. The Link field will be automatically filled in, depending on the menu item type selected. The Menu Location field is used to decide which menu you want this menu item to appear in. Select Main Menu from the drop-down list.

After clicking the Select button from the menu Item Type field, you’ll see a screen for selecting the menu item type (see Figure 6-20).

The Joomla system includes two menu item types to create menu links to pages that include search forms:

  • Search Search Form or Search Results: Used to display a standard search form that asks the user whether to search all words, any words, or an exact phrase that is entered in the search box.
  • Smart Search Search: Displays a standard search box and also shows the Advanced Search button that, when clicked, displays the text that helps users get the precise result. It displays the filters that enable users to search in required content type only.

For basic keyword search, select the Search ➤ Search Form or Search Results menu item type.

After entering the information for the menu item Searching, click the Save & Close icon to save it. You’ll see the Searching title appear in the list of menu items in the Main Menu, as shown in Figure 6-21.

After refreshing the front end of the web site, you will find the Searching menu item in the main menu of the site, as shown in Figure 6-22. If you click the Searching menu item, the search form appears that can be used for searching the desired content in the site.

Source: Harwani B M (2015), Foundations of Joomla!, Apress; 2nd ed edition

Leave a Reply

Your email address will not be published. Required fields are marked *