Class: ElasticRecord::Doctype

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_record/doctype.rb

Constant Summary collapse

DEFAULT_MAPPING =
{
  properties: {
  },
  _all: {
    enabled: false
  }
}
PERCOLATOR_MAPPING =
{
  properties: {
    query: {
      type: "percolator"
    }
  }
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, mapping = DEFAULT_MAPPING.deep_dup) ⇒ Doctype

Returns a new instance of Doctype.



25
26
27
28
29
# File 'lib/elastic_record/doctype.rb', line 25

def initialize(name, mapping = DEFAULT_MAPPING.deep_dup)
  @name = name
  @mapping = mapping
  @analysis = {}
end

Instance Attribute Details

#analysisObject

Returns the value of attribute analysis.



3
4
5
# File 'lib/elastic_record/doctype.rb', line 3

def analysis
  @analysis
end

#mappingObject

Returns the value of attribute mapping.



3
4
5
# File 'lib/elastic_record/doctype.rb', line 3

def mapping
  @mapping
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/elastic_record/doctype.rb', line 3

def name
  @name
end

Class Method Details

.percolator_doctypeObject



21
22
23
# File 'lib/elastic_record/doctype.rb', line 21

def self.percolator_doctype
  new('queries', PERCOLATOR_MAPPING)
end

Instance Method Details

#==(other) ⇒ Object



39
40
41
# File 'lib/elastic_record/doctype.rb', line 39

def ==(other)
  name == other.name && mapping == other.mapping && analysis == other.analysis
end