I am using Joomla 2.5.11 with the standard search module. Nothing fancy. There are two sibling sites, development and production. Unfortunately, one (non-tech-savy) admin did something in the backoffice that broke the search. I don't know exactly what, he could have used the auto-upgrade button, messing with modules/plugins. I noticed it because the search template visually changed, but I don't know how.
Fortunately, I still have a working search on the development site ; for comparison. All files in plugins/search, mod_search and components/search are identical. There are no php errors.
The behavior is the following : * I type a search "johndoe" in a page * Joomla redirects to the frontpage index.php?searchword=johndoe without showing the results
When I log the code, the last thing I can track is the SearchController (components/com_search/controller.php) :
function search()
{
[...]
$searchword = trim(str_replace($badchars, '', JRequest::getString('searchword', null, 'post')));
// if searchword enclosed in double quotes, strip quotes and do exact match
if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
$post['searchword'] = substr($searchword, 1, -1);
JRequest::setVar('searchphrase', 'exact');
}
else {
$post['searchword'] = $searchword;
}
$post['ordering'] = JRequest::getWord('ordering', null, 'post');
$post['searchphrase'] = JRequest::getWord('searchphrase', 'all', 'post');
$post['limit'] = JRequest::getUInt('limit', null, 'post');
if ($post['limit'] === null) unset($post['limit']);
[...]
$uri = JURI::getInstance();
$uri->setQuery($post);
$uri->setVar('option', 'com_search');
// index.php?searchword=johndoe&searchphrase=all&Itemid=117&option=com_search
$this->setRedirect(JRoute::_('index.php'.$uri->toString(array('query', 'fragment')), false));
}
So normally this url (index.php?searchword=johndoe&searchphrase=all&Itemid=117&option=com_search) should lead me somewhere into the search component. But it never founds it, instead it goes directly to the front page ; without instantiating the SearchModelSearch class (components/com_search/models/search.php).
How can I track the use of the class class SearchModelSearch extends JModelLegacy {}
Development site : http://gtsoul.net/cnjeu/presentation?searchword=catane
Regards
The problem was caused by a bad configuration in JoomSef (module for url rewriting).
The results page was linked to the homepage. And the homepage didn't contain a place to display results. In fact, the search was working but nothing was visible.
I went to JoomSEF > Manage SEF URL and look for a "option=com_search" url :
Search => index.php?option=com_search&view=search&Itemid=101
Itemid=101 is the homepage. I changed this parameter to Itemid=114 which is a empty content page, dedicated to this module.
Search => index.php?option=com_search&view=search&Itemid=114