Class: Cadet::CadetIndex::IndexProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/cadet/cadet_index/index_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(db) ⇒ IndexProvider

Returns a new instance of IndexProvider.



5
6
7
8
9
# File 'lib/cadet/cadet_index/index_provider.rb', line 5

def initialize(db)
  @db = db
  @indexes = {}
  @lucene_index = LuceneBatchInserterIndexProviderNewImpl.new(db)
end

Instance Method Details

#nodeIndex(name, type) ⇒ Object



10
11
12
# File 'lib/cadet/cadet_index/index_provider.rb', line 10

def nodeIndex(name, type)
  @indexes[name] ||= Cadet::CadetIndex::Index.new(@lucene_index, name, type)
end

#shutdown ⇒ Object



13
14
15
16
17
# File 'lib/cadet/cadet_index/index_provider.rb', line 13

def shutdown
  @indexes.each do |name, index|
    index.flush
  end
end