Class: ROM::Elasticsearch::Attribute
- Inherits:
-
Attribute
- Object
- Attribute
- ROM::Elasticsearch::Attribute
- Defined in:
- lib/rom/elasticsearch/attribute.rb
Overview
ES-specific attribute types for schemas
Constant Summary collapse
- INTERNAL_META_KEYS =
%i[name source primary_key].freeze
- DEFAULT_SORT_DIRECTION =
'asc'.freeze
Instance Method Summary collapse
-
#asc ⇒ Attribute
Return attribute with direction set to ascending.
-
#desc ⇒ Attribute
Return attribute with direction set to descending.
-
#properties ⇒ Hash
Return ES mapping properties.
-
#properties? ⇒ Bool
Return if an attribute has any ES mappings.
Instance Method Details
#asc ⇒ Attribute
Return attribute with direction set to ascending
35 36 37 |
# File 'lib/rom/elasticsearch/attribute.rb', line 35 def asc (direction: 'asc') end |
#desc ⇒ Attribute
Return attribute with direction set to descending
44 45 46 |
# File 'lib/rom/elasticsearch/attribute.rb', line 44 def desc (direction: 'desc') end |
#properties ⇒ Hash
Return ES mapping properties
17 18 19 |
# File 'lib/rom/elasticsearch/attribute.rb', line 17 memoize def properties type..reject { |k, _| INTERNAL_META_KEYS.include?(k) } end |
#properties? ⇒ Bool
Return if an attribute has any ES mappings
26 27 28 |
# File 'lib/rom/elasticsearch/attribute.rb', line 26 def properties? properties.size > 0 end |