Support Resources

LucidWorks Forum
KnowledgeBase

LucidWorks Search v2.5

PDF Versions

Older Versions

LucidWorks 2.1
LucidWorks 2.0
LucidWorks 1.8

This is the documentation for the LucidWorks Search v2.5, the latest release. Go here for LucidWorks 2.1.

Skip to end of metadata
Go to start of metadata

The Caches API allows creating, viewing, updating and deleting cache information configured in the solrconfig.xml file for the collection.

Caches are used in Solr to store information from the index for faster responses if the index information is needed again. They are associated with a specific instance of a Solr IndexSearcher, and the cached information is valid as long as the IndexSearcher is valid. When a new IndexSearcher is opened, it is usually auto-warmed (pre-populated) with data from the previous cache. The settings on this page help define the size of caches and how they are used to auto-warm a new IndexSearcher.

These are advanced settings, and modifying them should be done with care.

API Entry Points

/api/collections/collection/caches: get details of all configured caches or create a new cache.
/api/collections/collection/chaches/name: update, delete, or get details for a specific cache.

Get a List of Caches and Attributes for a Collection

GET /api/collections/collection/caches

Input

Path Parameters

Enter path parameters.

Key Description
collection The collection name.

Query Parameters

None.

Output

Output Content

A JSON List of Maps mapping Collection keys to values.

Key Type Description
name string The name of the cache. There are four known caches that are used in most implementations, which correspond to known Solr caches. These are:
  • field_value_cache, which implements Solr's fieldValueCache. This cache is mostly used for faceting. If it is not explicitly set in solrconfig.xml, then it is generated automatically with default values (initial_size = 10, max_size=10000, and autowarm_count = 0).
  • document_cache, which implements Solr's documentCache. This cache stores Lucene document objects.
  • filter_cache, which implements Solr's filterCache. This cache stores unordered sets of all documents for a query, and is used by Solr for filter queries (and thus by LucidWorks for the Search Filter functionality). It can also be used for faceting, sorting, or other situations that require the full set of documents that match a query.
  • query_result_cache, which implements Solr's queryResultCache. This cache stores ordered sets of document IDs from previous searches.
    A custom cache implementation can also be created and used if a Solr plugin has been created for your application.
class string The cache implementation that's used for this cache.  There are two available types, solr.LRUCache and solr.FastLRUCache. The other properties for the cache depend on the implementation that is used.  See the following table for details of attributes that can be used for each cache implementation.

The "LRU" part of the cache class name stands for "Least Recently Used". When an LRU cache fills up, the entry with the oldest last-accessed timestamp is removed to make room for the new entry. Frequently used items tend to remain cached, while less-used items will drop out of cache to be retrieved again later if they are needed. The FastLRUCache is meant to be lock-less, so is well-suited for caches that are hit several times in a request.
regenerator string A valid class name which specifies how to re-populate a new cache created by a new Searcher with old cache objects. Usually only declared for custom caches.

solr.LRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher.

solr.FastLRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher.
min_size integer When the cache hits it's size limit, this allows the cache to try to reduce to this value. The default is 0.9 * size.
acceptable_size integer When the cache removes old entries, it tries to achieve the min_size. If that is not possible, it tries to achieve acceptable_size instead. The default is 0.95 * size.
cleanup_thread boolean If set to true, cache cleanup will run in a dedicated separate thread. Very large cache sizes may perform better if they are in a dedicated thread.
show_items integer Used to debug what's contained in the cache. Will return the last N accessed items in the Solr Admin UI, using an MBeans Request Handler or JMX. A value of "-1" will display all items in the cache.

Response Codes

200: OK

Examples

Input

curl http://localhost:8888/api/collections/collection1/caches

Output

[
{
	"initial_size":"512",
	"name":"document_cache",
	"class":"solr.LRUCache",
	"autowarm_count":"0",
	"size":"512"
},
{
	"initial_size":"512",
	"name":"filter_cache",
	"class":"solr.LRUCache",
	"autowarm_count":"256",
	"size":"512"
},
{
	"initial_size":"512",
	"name":"query_result_cache",
	"class":"solr.LRUCache",
	"autowarm_count":"256",
	"size":"512"
},
{
	"acceptable_size":null,
	"initial_size":"10",
	"name":"field_value_cache",
	"class":"solr.FastLRUCache",
	"cleanup_thread":null,
	"autowarm_count":null,
	"show_items":"-1",
	"min_size":null,
	"size":"10000"
}
]

Back to Top

Create a Cache and Attributes for a Collection

POST /api/collections/collection/caches

Input

Path Parameters

Enter path parameters.

Key Description
collection The collection name.

Query Parameters

None.

Input Content
A JSON List of Maps mapping Collection keys to values.

Key Type Description
name string The name of the cache. There are four known caches that are used in most implementations, which correspond to known Solr caches. These are:
  • field_value_cache, which implements Solr's fieldValueCache. This cache is mostly used for faceting. If it is not explicitly set in solrconfig.xml, then it is generated automatically with default values (initial_size = 10, max_size=10000, and autowarm_count = 0).
  • document_cache, which implements Solr's documentCache. This cache stores Lucene document objects.
  • filter_cache, which implements Solr's filterCache. This cache stores unordered sets of all documents for a query, and is used by Solr for filter queries (and thus by LucidWorks for the Search Filter functionality). It can also be used for faceting, sorting, or other situations that require the full set of documents that match a query.
  • query_result_cache, which implements Solr's queryResultCache. This cache stores ordered sets of document IDs from previous searches.
    A custom cache implementation can also be created and used if a Solr plugin has been created for your application.
class string The cache implementation that's used for this cache.  There are two available types, solr.LRUCache and solr.FastLRUCache. The other properties for the cache depend on the implementation that is used.  See the following table for details of attributes that can be used for each cache implementation.

The "LRU" part of the cache class name stands for "Least Recently Used".  When an LRU cache fills up, the entry with the oldest last-accessed timestamp is removed to make room for the new entry. Frequently used items tend to remain cached, while less-used items will drop out of cache to be retrieved again later if they are needed. The FastLRUCache is meant to be lock-less, so is well-suited for caches that are hit several times in a request.
regenerator string A valid class name which specifies how to re-populate a new cache created by a new Searcher with old cache objects. Usually only declared for custom caches.

solr.LRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher. If setting to a percentage, be sure to enclose the value in quotes, such as "autowarm":"50%". Setting to a number of entries does not require quotes.

solr.FastLRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher. If setting to a percentage, be sure to enclose the value in quotes, such as "autowarm":"50%". Setting to a number of entries does not require quotes.
min_size integer When the cache hits it's size limit, this allows the cache to try to reduce to this value. The default is 0.9 * size.
acceptable_size integer When the cache removes old entries, it tries to achieve the min_size. If that is not possible, it tries to achieve acceptable_size instead. The default is 0.95 * size.
cleanup_thread boolean If set to true, cache cleanup will run in a dedicated separate thread. Very large cache sizes may perform better if they are in a dedicated thread.
show_items integer Used to debug what's contained in the cache. Will return the last N accessed items in the Solr Admin UI, using an MBeans Request Handler or JMX. A value of "-1" will display all items in the cache.

Output

Output Content

None.

Response Codes

List valid response codes and meaning

Examples

Input

curl -H 'Content-type: application/json' -d '{"name":"newcache","class":"solr.LRUCache","size":500}' \
 http://localhost:8888/api/collections/collection1/caches

Output

None.

Back to Top

Update Cache Attributes

PUT /api/collections/collection/caches/name

Input

Path Parameters

Enter path parameters.

Key Description
collection The collection name.
name The cache name.

Query Parameters

None.

Input Content
A JSON List of Maps mapping Collection keys to values.

Key Type Description
name string The name of the cache. There are four known caches that are used in most implementations, which correspond to known Solr caches. These are:
  • field_value_cache, which implements Solr's fieldValueCache. This cache is mostly used for faceting. If it is not explicitly set in solrconfig.xml, then it is generated automatically with default values (initial_size = 10, max_size=10000, and autowarm_count = 0).
  • document_cache, which implements Solr's documentCache. This cache stores Lucene document objects.
  • filter_cache, which implements Solr's filterCache. This cache stores unordered sets of all documents for a query, and is used by Solr for filter queries (and thus by LucidWorks for the Search Filter functionality). It can also be used for faceting, sorting, or other situations that require the full set of documents that match a query.
  • query_result_cache, which implements Solr's queryResultCache. This cache stores ordered sets of document IDs from previous searches.
    A custom cache implementation can also be created and used if a Solr plugin has been created for your application.
class string The cache implementation that's used for this cache.  There are two available types, solr.LRUCache and solr.FastLRUCache. The other properties for the cache depend on the implementation that is used. See the following table for details of attributes that can be used for each cache implementation.

The "LRU" part of the cache class name stands for "Least Recently Used".  When an LRU cache fills up, the entry with the oldest last-accessed timestamp is removed to make room for the new entry. Frequently used items tend to remain cached, while less-used items will drop out of cache to be retrieved again later if they are needed. The FastLRUCache is meant to be lock-less, so is well-suited for caches that are hit several times in a request.
regenerator string A valid class name which specifies how to re-populate a new cache created by a new Searcher with old cache objects. Not needed for most implementations.

solr.LRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher. If setting to a percentage, be sure to enclose the value in quotes, such as "autowarm":"50%". Setting to a number of entries does not require quotes.

solr.FastLRUCache Attributes

Key Type Description
size integer The maximum number of entries in the cache.
initial_size integer The initial number of entries in the cache.
autowarm_count integer The number of entries to pre-populate from an old cache, or can be a percentage of the old cache. When a new Searcher is opened, it may be pre-populated with cached objects from the old Searcher. A best practice is to base the autowarm_count on how long it takes to autowarm a new Searcher. If setting to a percentage, be sure to enclose the value in quotes, such as "autowarm":"50%". Setting to a number of entries does not require quotes.
min_size integer When the cache hits it's size limit, this allows the cache to try to reduce to this value. The default is 0.9 * size.
acceptable_size integer When the cache removes old entries, it tries to achieve the min_size. If that is not possible, it tries to achieve acceptable_size instead. The default is 0.95 * size.
cleanup_thread boolean If set to true, cache cleanup will run in a dedicated separate thread. Very large cache sizes may perform better if they are in a dedicated thread.
show_items integer Used to debug what's contained in the cache. Will return the last N accessed items in the Solr Admin UI, using an MBeans Request Handler or JMX. A value of "-1" will display all items in the cache.

Output

Output Content

None.

Examples

Input

curl -X PUT -H 'Content-type: application/json' -d '{"autowarm_count":"50%"}' \
http://localhost:8888/api/collections/collection1/caches/newcache

Output

None.

Back to Top

Delete a Cache

GET /api/collections/collection/caches/name

Input

Path Parameters

Enter path parameters.

Key Description
collection The collection name.
name The cache name.

Query Parameters

None.

Output

Output Content

None.

Response Codes

None.

Examples

Input

curl -X DELETE http://localhost:8888/api/collections/collection1/caches/newcache

Back to Top

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.