Module: SimpleSolrClient::Core::CoreData
- Included in:
- SimpleSolrClient::Core
- Defined in:
- lib/simple_solr_client/core/core_data.rb
Instance Attribute Summary collapse
-
#raw_solr_hash ⇒ Object
readonly
Returns the value of attribute raw_solr_hash.
Instance Method Summary collapse
- #config_file ⇒ Object
-
#core_data_hash ⇒ Object
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.
-
#data_dir ⇒ Object
The (local to the server) data directory.
- #index ⇒ Object
- #instance_dir ⇒ Object
-
#last_modified ⇒ Object
Time of last modification.
-
#number_of_documents ⇒ Object
(also: #numDocs, #num_docs)
Total documents.
-
#size ⇒ Object
Get the index size in megabytes.
Instance Attribute Details
#raw_solr_hash ⇒ Object (readonly)
Returns the value of attribute raw_solr_hash.
2 3 4 |
# File 'lib/simple_solr_client/core/core_data.rb', line 2 def raw_solr_hash @raw_solr_hash end |
Instance Method Details
#config_file ⇒ Object
57 58 59 |
# 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 ⇒ Object
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.
12 13 14 15 |
# 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 ⇒ Object
The (local to the server) data directory
35 36 37 |
# File 'lib/simple_solr_client/core/core_data.rb', line 35 def data_dir core_data_hash['dataDir'] end |
#index ⇒ Object
17 18 19 |
# File 'lib/simple_solr_client/core/core_data.rb', line 17 def index core_data_hash['index'] end |
#instance_dir ⇒ Object
53 54 55 |
# File 'lib/simple_solr_client/core/core_data.rb', line 53 def instance_dir core_data_hash['instanceDir'] end |
#last_modified ⇒ Object
Time of last modification
22 23 24 |
# File 'lib/simple_solr_client/core/core_data.rb', line 22 def last_modified Time.parse index['lastModified'] end |
#number_of_documents ⇒ Object Also known as: numDocs, num_docs
Total documents
27 28 29 |
# File 'lib/simple_solr_client/core/core_data.rb', line 27 def number_of_documents index['numDocs'] end |
#size ⇒ Object
Get the index size in megabytes
41 42 43 44 45 46 47 48 49 50 51 |
# 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 |