Actions

Search uncategorised articles

From Joomla! Documentation

One of the issues with CMS's like Joomla is stopping the site search from finding thank you, registration or stand alone pages in the "uncategorised" or other sections.

The file to alter is /plugins/search/content.php

Two options are available depending on how you wish to manage your site

If you store all your standalone pages in uncategorised section then proceed as follows

Find the code below at around line 56

Comment out the line with

$sUncategorised = $pluginParams->get( 'search_uncategorised', 1 );

as indicated below:

// load plugin params info
$plugin         =& JPluginHelper::getPlugin('search', 'content');
$pluginParams   = new JParameter( $plugin->params );
 
$sContent       = $pluginParams->get( 'search_content',       1 );
 // $sUncategorised = $pluginParams->get( 'search_uncategorised',    1 );
$sArchived       = $pluginParams->get( 'search_archived',       1 );
$limit          = $pluginParams->def( 'search_limit',       50 );

If you wish to make it more comprehensive so that any content item is not searched then add the following line of code $wheres2[] = "LOWER(a.metakey) NOT LIKE '{nosearch}'"; as shown below. (approx line 83)

$wheres = array();
switch ($phrase) {
  case 'exact':
    $text = $db->getEscaped($text);
    $wheres2    = array();
    $wheres2[]    = "LOWER(a.title) LIKE '%$text%'";
    $wheres2[]    = "LOWER(a.introtext) LIKE '%$text%'";
    $wheres2[]    = "LOWER(a.`fulltext`) LIKE '%$text%'";
    $wheres2[]    = "LOWER(a.metakey) LIKE '%$text%'";
    $wheres2[]    = "LOWER(a.metadesc) LIKE '%$text%'";
    $wheres2[]    = "LOWER(a.metakey) NOT LIKE '%{nosearch}%'";
    $where       = '(' . implode( ') OR (', $wheres2 ) . ')';
  break;

If you insert "{nosearch}" into the "Meta Info - Keywords", the content item will not be listed even if there are matches in the search.