Module: ElasticMapper

Defined in:
lib/elastic_mapper.rb,
lib/elastic_mapper/version.rb

Defined Under Namespace

Modules: Index, Mapping, Search

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Include all of the submodules, so that we can optinally use elasticmapper by simply including the root module.



53
54
55
56
57
# File 'lib/elastic_mapper.rb', line 53

def self.included(base)
  base.send(:include, ElasticMapper::Mapping)
  base.send(:include, ElasticMapper::Index)
  base.send(:include, ElasticMapper::Search)
end

.indexStretcher::Index

Return the index associated with the default index name.

Returns:

  • (Stretcher::Index)

    index object.



30
31
32
# File 'lib/elastic_mapper.rb', line 30

def self.index
  ElasticMapper.server.index(index_name)
end

.index_nameString

Return the index name.

Returns:

  • (String)

    name of index.



22
23
24
# File 'lib/elastic_mapper.rb', line 22

def self.index_name
  @@index_name
end

.index_name=(index_name) ⇒ Object

The index name to use for ElasticMapper. the models themselves are namespaced by a mapping names.

Parameters:

  • index_name (String)

    name of index.



15
16
17
# File 'lib/elastic_mapper.rb', line 15

def self.index_name=(index_name)
  @@index_name = index_name
end

.serverStretcher::Server

Return the server object associated with ElasticMapper.

Returns:

  • (Stretcher::Server)


46
47
48
# File 'lib/elastic_mapper.rb', line 46

def self.server
  @@server ||= Stretcher::Server.new
end

.server=(server) ⇒ Object

Allow the ES server to be overriden by an instance with custom initialization.

Parameters:

  • server (Stretcher::Server)

    ES server.



38
39
40
# File 'lib/elastic_mapper.rb', line 38

def self.server=(server)
  @@server = server
end