Jake Bunce
Well-known member
(in response to this post)
This is a code modification that will disable search caching. In other words, every time you submit a search it will perform a brand new search and not look at previous results. This has potential to increase server load on busy forums, but it will ensure that search results are always current.
Edit this file:
library/XenForo/Model/Search.php
Find this code and add the red code:
Note that the cache will still be employed if you link directly to the search results. You need to submit a new search if you want fresh results. You can use a URL to submit a new search if you want. Use this format:
index.php?search/search/&keywords=term
This is a code modification that will disable search caching. In other words, every time you submit a search it will perform a brand new search and not look at previous results. This has potential to increase server load on busy forums, but it will ensure that search results are always current.
Edit this file:
library/XenForo/Model/Search.php
Find this code and add the red code:
Rich (BB code):
public function getExistingSearch($searchType, $searchQuery, array $constraints, $order, $groupByDiscussion, $userId, $forceUsage = false)
{
return false;
if (XenForo_Application::debugMode() && !$forceUsage)
{
return false;
}
$queryHash = $this->getSearchQueryHash($searchType, $searchQuery, $constraints, $order, $groupByDiscussion);
return $this->_getDb()->fetchRow('
SELECT *
FROM xf_search
WHERE query_hash = ?
AND search_type = ?
AND search_query = ?
AND user_id = ?
AND search_date > ?
ORDER BY search_date DESC
LIMIT 1
', array($queryHash, $searchType, $searchQuery, $userId, XenForo_Application::$time - 3600));
}
Note that the cache will still be employed if you link directly to the search results. You need to submit a new search if you want fresh results. You can use a URL to submit a new search if you want. Use this format:
index.php?search/search/&keywords=term