Module: TanningBed::ClassMethods
- Defined in:
- lib/tanning_bed.rb
Instance Method Summary collapse
- #solr_load(results) ⇒ Object
- #solr_reindex ⇒ Object
- #solr_search(query_string, options = {}) ⇒ Object
Instance Method Details
#solr_load(results) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/tanning_bed.rb', line 23 def solr_load(results) key_set = results.collect do |result| key = result["search_id"].first.split(" ") next if key[0] != self.to_s Kernel.const_get(key[0]).send(:get, key[1]) end key_set.delete(nil) return key_set end |
#solr_reindex ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/tanning_bed.rb', line 33 def solr_reindex # Remove all the old entries for this class TanningBed.solr_connection.delete_by_query(self.to_s) #Add all the current records into the index self.all.each do |item| item.solr_add end end |
#solr_search(query_string, options = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/tanning_bed.rb', line 17 def solr_search(query_string, ={}) TanningBed.solr_connection.query(query_string + " AND type_t:#{self}", ) rescue Errno::ECONNREFUSED => e TanningBed.solr_exception(e) end |