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 read].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
37 38 39 |
# File 'lib/rom/elasticsearch/attribute.rb', line 37 def asc (direction: 'asc') end |
#desc ⇒ Attribute
Return attribute with direction set to descending
46 47 48 |
# File 'lib/rom/elasticsearch/attribute.rb', line 46 def desc (direction: 'desc') end |
#properties ⇒ Hash
Return ES mapping properties
19 20 21 |
# File 'lib/rom/elasticsearch/attribute.rb', line 19 memoize def properties type..reject { |k, _| INTERNAL_META_KEYS.include?(k) } end |
#properties? ⇒ Bool
Return if an attribute has any ES mappings
28 29 30 |
# File 'lib/rom/elasticsearch/attribute.rb', line 28 def properties? properties.size > 0 end |