Eric Wilson
Eric Wilson

Reputation: 59355

How to clear the cache in Solr?

I'm trying to compare the performance of different Solr queries. In order to get a fair test, I want to clear the cache between queries.

How is this done? Of course, one can restart the server, I was curious if there is a quicker way.

Upvotes: 17

Views: 22328

Answers (3)

Hafiz Muhammad Shafiq
Hafiz Muhammad Shafiq

Reputation: 8670

Just for thorough details

If you want to disable a cache (or all), comment out those sections in solrconfig.xml and restart solr.

example diable queryResultCache

   <!-- 
   <queryResultCache class="solr.LRUCache"
                      size="5000"
                      initialSize="5000"
                      autowarmCount="2000"/>

-->

Upvotes: 0

bubbassauro
bubbassauro

Reputation: 4279

I'm using version 4.2.1 and even with autowarmCount="0" the cache is not updated after doing a Dataimport.

In that case, on Solr Admin (usually http://localhost:8983/)

Go to Core Admin and click Reload. When refreshed, you should see a green check mark on the "current" field.

Upvotes: 7

nikhil500
nikhil500

Reputation: 3450

Disable all the caches from solrconfig.xml.

Note that the Lucene FieldCache will still be enabled.

Upvotes: 3

Related Questions