Joomla 3.1 Search Component Tutorial

The Joomla Search component allows you to do two things – view statistics about what people are searching for on your site and customize the available search settings. In this tutorial, we’ll cover both of these topics, starting first with search statistics.

Searching for Components in Joomla

Search Statistics

Enabling Gathering of Search Statistics

When you first access the Joomla Search Component, you’ll see a Gathering statistics disabled error message. To being using the search statistics feature, we’ll first enable statistics gathering.

  1. Log into your Joomla 3.0 admin dashboard
  2. In the top menu, click Components and then click Search
  3. Click the Options button towards the top of the page
  4. Set the Gather Search Statistics setting to Yes, and then click the Save & Close button towards the top of the page.The page will refresh and then you will see a message that says Gathering statistics enabled.

Viewing What Users Are Searching For

In our testing, we used the search module on our website to search for the following words (each one in a separate search): apple, orange, and fruit. Using the search statistics feature, we can see information on these searches that we just performed.

  1. Log into your Joomla 3.0 admin dashboard
  2. In the top menu, click Components and then click Search
     
    search-statistics

    That’s it! As you can see in the screenshot to the right, Joomla shows a listing of all phrases searched for on the site, how many times each phrase was searched for (referred to as hits), and the number of results for each search.

    Showing the Number of Search Results

    In the screenshot above, you can see under the Results column it simply says Off. If you want to see how many search results are returned for each search phrase, find and click on the button that says Show Search Results.In our testing, we don’t have any articles about oranges, apples, or fruit. We do have a few articles about the word blog, so we’ll show you how the Results feature works by searching our site for blog.As you can see in the screenshots below, we have 9 results for the word blog, and the search component similarly shows 9 search results.

    A Search For the Word BlogResults Data Shown in the Search Component
    nine-search-results-returned
    search-component-showing-nine-results-as-well

Resetting Search Data

For busy websites, your users may search on your website quite often. With so much data showing in the search statistics, it may make it difficult to find the information you’re actually looking for. Clearing the search statistics will remove all data, and allow you to start fresh.

  1. Log into your Joomla 3.0 admin dashboard
  2. In the top menu, click Components and then click Search
  3. In the top menu, click the Reset button.You can see below what the search statistics look like before and after we click the reset button.
    Before Clicking ResetAfter Clicking Reset
    before-clicking-reset
    after-resetting-search-statistics

Search Options

There are several options available that you can use to customize the way your Joomla site’s search works. Below, we will show you how to access these settings, and we will also explain what each of them controls.

  1. Log into your Joomla 3.0 admin dashboard
  2. In the top menu, click Components and then click Search
  3. Click the Options button towards the top of the page
  4. Adjust the settings as you see fit, and then click the Save button in the top left of the page. Below is a summary of several of the settings.

    Use Search Areas

    search-only

    The Use Search Areas setting gives your users the option to search only through certain types of content. For example, if the user only wants to search through Newsfeed and not Articles, using the search areas feature (shown to users as Search Only) they can do this. If you disable this setting, the Search Only feature (highlighted in the screenshot to the right) will not show to users.

     

    Created Date

    search-created-on
     

    By default, when you search a Joomla site, in the results the date the article was created on will show. If you disable the created date feature, the search results will no longer show the Created on data. In the screenshot to the right, we’ve highlighted the created on feature so you know exactly what it is we’re referring to.

     

    OpenSearch

    opensearch
     

    Are you familiar with the Google search bar in the top right of your firefox browser? That’s an OpenSearch feature. If you see in the screenshot to the right, when you’re on our Joomla site’s search results page, users have the option to add a custom OpenSearch toolbar, which will allow them to quickly search our site, and only our site.

    OpenSearch was developed in 2005 by Amazon. In our many years in technical support, the phrase OpenSearch has not come up often, but most everyone is familiar with what it is (but maybe not its name).

    The Joomla Search Component includes two OpenSearch settings, OpenSearch Name and OpenSearch Description.

    In our testing, we entered the following settings:

    OpenSearch NameJoomla 3.0.2 Testing site
    OpenSearch DescriptionThis website is driven by Joomla 3.0.2, and is used as a testing ground for testing Joomla.

    Now that we’ve adjusted these settings, how do we see what has changed?

    Go to your Joomla website and perform any search. Then view the source code of the page and you should see something similar to the follow:

    <link href="https://domain.com/component/search/?searchword=blog&ordering=newest&searchphrase=all&
    limit=20&format=opensearch"
    rel="search" title="Search Joomla 3.0.2"
    type="application/opensearchdescription+xml"/>

    If you access this URL, it will prompt you to download a file named download.osdx. When you open that file with a text editor, such as notepad, you should see something similar to the following:

    <?xml version="1.0" encoding="utf-8"?>
    <OpenSearchDescription xmlns="https://a9.com/-/spec/opensearch/1.1/">
    <ShortName>Joomla 3.0.2 Testing site</ShortName>
    <Description>This website is driven by Joomla 3.0.2, and is used as a testing ground for testing Joomla.
    </Description>
    <InputEncoding>UTF-8</InputEncoding>
    <Image type="image/vnd.microsoft.icon" width="16" height="16">
    https://domain.com/templates/protostar/favicon.ico</Image>
    <Url type="application/opensearchdescription+xml" rel="self"
    template="https://domain.com/component/search/?searchword=blog&ordering=newest&searchphrase=all&
    limit=20&format=opensearch"/>
    <Url type="text/html"
    template="https://bradm.rubelix.com/joomla3.0.2/index.php?option=com_search&searchword={searchTerms}"/>
    </OpenSearchDescription>

    We’d love to tell you what all this means, but it honestly isn’t something we’re very familiar with. The take home point is that the Joomla allows you to customize these OpenSearch settings if you need to do so.

    Search For

    If you notice in the screenshots above, the search feature includes a Search for option. This option allows users to search either for All words, Any words, or Exact Phrase.

    We received a question on how to hide this functionality. There does not seem to be a setting in Joomla to do this. To accomplish this however, we can edit our template’s CSS.

    To hide the Search for feature, edit your template’s CSS file and add the following code to the bottom:

    #searchForm fieldset.phrases {display:none;}
    If you’re using the protostar template, this is the file you will need to edit:

    templates/protostar/css/template.css
    In our testing, using this ‘work around’ solved the problem. After making the change, be sure to clear your browser’s cache so the update CSS file is used.

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+