Class: MongoTanker::Tank::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_tanker/tank/index.rb

Class Method Summary collapse

Class Method Details

.open(index_name, scope = 'private') ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mongo_tanker/tank/index.rb', line 7

def self.open(index_name, scope = 'private')
  url       = (scope == 'private') ? MongoTanker.private_url : MongoTanker.public_url
  client    = IndexTank::Client.new url
  index     = client.indexes index_name

  unless index.exists?
    index.add :public_search => true

    while not index.running?
      sleep 0.5
    end
  end

  return index
end