module SimpleSolrClient::Core::CoreData
Attributes
raw_solr_hash[R]
Public Instance Methods
config_file()
click to toggle source
# File lib/simple_solr_client/core/core_data.rb, line 57 def config_file File.join(instance_dir, 'conf', core_data_hash['config']) end
core_data_hash()
click to toggle source
Get the core data for this core This is weird in that while the data is about a specific core, we need to call it at the client_url level; hence all the screwing around with force_top_level_url
It would make sense to cache this until, say, a commit or a reload, but the added complexity isn't yet worth it.
# File lib/simple_solr_client/core/core_data.rb, line 12 def core_data_hash cdata = get('admin/cores', {:force_top_level_url => true}) cdata['status'][core] end
data_dir()
click to toggle source
The (local to the server) data directory
# File lib/simple_solr_client/core/core_data.rb, line 35 def data_dir core_data_hash['dataDir'] end
index()
click to toggle source
# File lib/simple_solr_client/core/core_data.rb, line 17 def index core_data_hash['index'] end
instance_dir()
click to toggle source
# File lib/simple_solr_client/core/core_data.rb, line 53 def instance_dir core_data_hash['instanceDir'] end
last_modified()
click to toggle source
Time of last modification
# File lib/simple_solr_client/core/core_data.rb, line 22 def last_modified Time.parse index['lastModified'] end
number_of_documents()
click to toggle source
Total documents
# File lib/simple_solr_client/core/core_data.rb, line 27 def number_of_documents index['numDocs'] end
size()
click to toggle source
Get the index size in megabytes
# File lib/simple_solr_client/core/core_data.rb, line 41 def size str = index['size'] num, unit = str.split(/\s+/).compact.map(&:strip) num = num.to_f case unit when "MB" num * 1 when "GB" num * 1000 end end