Module: ThinkingTank::IndexMethods

Defined in:
lib/thinkingtank/init.rb

Instance Method Summary collapse

Instance Method Details

#delete_from_indexObject



73
74
75
76
77
# File 'lib/thinkingtank/init.rb', line 73

def delete_from_index
    it = ThinkingTank::Configuration.instance.client
    docid = self.class.name + ' ' + self.id.to_s
    it.document(docid).delete()            
end

#update_indexObject



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/thinkingtank/init.rb', line 60

def update_index
    it = ThinkingTank::Configuration.instance.client
    docid = self.class.name + ' ' + self.id.to_s
    data = {}
    self.class.thinkingtank_builder.index_fields.each do |field|
        val = self.instance_eval(field.to_s)
        data[field.to_s] = val.to_s unless val.nil?
    end
    data[:__any] = data.values.join " . "
    data[:__type] = self.class.name
    it.document(docid).add(data)
end