Back to mnoGoSearch site

mnoGoSearch 3.3.12 reference manual: Full-featured search engine software
PrevChapter 10. Searching documentsNext

Search results cache

By caching the results of search queries, search.cgi can avoid having to repeat time-consuming CPU and disk operations needed to generate the search results. This helps search.cgi to respond very quickly in case if the same search query was done recently, as well as when the user is navigating through the pages of the same result seeing documents 11-20, 21-30, and so on.

Note: mnoGoSearch 3.3.8 introduced a new type of search result cache, which is activated using the QCache=yes parameter to DBAddr. The old cache implementation which was controlled by the Cache (obsolete) command is obsolete and should not be used.

The new search result cache stores its data in the qcache table in the mnoGoSearch database. New search result cache implementation additionally supports the search in found feature, also often referenced to as refine your search.

Search result cache is automatically invalidated when indexer -Eblob is executed.

When checking if a previously cached search result exists for the current search query, search.cgi also verifies that all search parameters that may affect the way search query is executed match in the current and the cached queries. This guarantees that search.cgi normally returns exactly the same results, with query cache enabled or disabled. However, search.cgi does not check if any of search.htm commands have changed between the times of executions of the cached query and the current query. That means, if you change any of the commands affecting score, make sure to clear query cache.

Clearing search result cache

To clear search result cache please use TRUNCATE TABLE qcache or a similar SQL statement (depending on your database software).

Old search result cache

The rest of this article applies to the old search result cache implementation.

Search results cache is disabled by default. You may use "Cache yes" search.htm command to enable results caching.

Search cache is located in the $PREFIX/var/cache/ subdirectory, where $PREFIX is mnoGoSearch installation's base directory. Each result is stored in a separate file.

Note: Search results cache is not deleted automatically. You have to delete it every time after indexer's work to avoid displaying non-recent cached results. It is also reasonable to insert cache cleaning into system crontab, for example once a day. To clean cache, just remove all files in the $PREFIX/var/cache/ directory. For example:

/bin/rm -f /usr/local/mnoGoSearch/var/cache/*