Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can search results be cached? [closed]

How do I implement caching mechanism of search results as on stackoverflow? How does elastic search and lucene deal with caching?

like image 676
Ann Stor Avatar asked Jan 27 '15 15:01

Ann Stor


People also ask

Are Google search results cached?

Google generates a cached version so that users can still access the web page, for example, if the site isn't available. The cache: operator is only available on web search.

How long do cached pages stay on Google?

Webpages are cached for approximately 90 days after Google crawls them. How long do cached pages stay in Google's cache? Google keeps webpages in their cache for about 90 days, or until the page is crawled again.

Why does cache keep coming back?

You might notice that when you clear cache, it comes back eventually. This is normal; over time, apps will build up cache again based on your usage. Because cache is useful, you shouldn't worry when an app builds up cached files. Clearing cache shouldn't log you out of apps or cause any other major changes.

What is caching and how it works?

In computing, a cache is a high-speed data storage layer which stores a subset of data, typically transient in nature, so that future requests for that data are served up faster than is possible by accessing the data's primary storage location.


1 Answers

As of now, you can cache in two different ways within Elasticsearch

  1. Filter cache - Here if you can offload as many constraints which don't take part in scoring of results, you can have segment level caches for that particular filter alone. This along with warmer API provides some decent amount in memory based caching for the filters applied alone
  2. Shard request cache * - You can cache the results ( Other than hits) on query level. This is pretty new feature and should provide a good amount of caching. But still _source needs to be still taken the shards.

Within Elasticsearch you can exploit these features to attain a good amount of caching. Also, you can explore other caching option external to Elasticsearch to memcache or other in memory caches.

  • previously called shared query cache
like image 75
Vineeth Mohan Avatar answered Oct 16 '22 11:10

Vineeth Mohan