Reputation: 797
As I understand it, queryChache
caches a list of matched documentIds for each query.
Based on the information provided in the book Solr in Action
, we set the queryResultMaxDocsCached
parameter to a value based on the maximum number of documents we want each query to cache. If that is true, does that value add to the amount we set in documentCache
? What is the difference between the two ?
Excerpted from Solr in Action
for queryResultMaxDocsCached
As you can imagine, a result set holding millions of documents in the cache would greatly impact available memory in Solr. The element allows you to limit the number of documents cached for each entry in the query result cache.
Excerpted from Solr in Action
for documentCache
The query result cache holds a list of internal document IDs that match a query, so even if the query results are cached, Solr still needs to load the documents from disk to produce search results. The document cache is used to store documents loaded from disk in memory keyed by their internal document IDs. It follows that the query result cache uses the document cache to find cached versions of documents in the cached result set.
Upvotes: 0
Views: 765
Reputation: 52802
As you can see from the descriptions you've posted, the queryCache keeps the query mapped to the document ids for that query. i.e. a search for "foo" gave "these ids": foo -> [1, 2, 3, 4, 5, 6]
The Document Cache simplifies the lookup of those document ids, meaning that Solr won't have to attempt to load them from disk again: 1 -> {'bar': 'foo', 'spam': 'eggs'}, 2 -> {'bar': 'foo', 'python': 'idle'}, 3 -> ...,
etc.
If you have a different query, but it still references the same set of (or a subset of) documents, those documents can be looked up in the cache instead of being read from disk: bar -> [2, 8, 16]
would still be able to find document 2
in the cache, and avoid going to disk to load the details of the document.
These caches are separate, and handled by separate settings.
Upvotes: 1