Class: AgnosticBackend::Cloudsearch::IndexField
- Inherits:
-
Object
- Object
- AgnosticBackend::Cloudsearch::IndexField
- Includes:
- Utilities
- Defined in:
- lib/agnostic_backend/cloudsearch/index_field.rb
Constant Summary collapse
- TYPE_MAPPINGS =
{ AgnosticBackend::Indexable::FieldType::STRING => "literal", AgnosticBackend::Indexable::FieldType::STRING_ARRAY => "literal-array", AgnosticBackend::Indexable::FieldType::DATE => "date", AgnosticBackend::Indexable::FieldType::DATE_ARRAY=> "date-array", AgnosticBackend::Indexable::FieldType::INTEGER => "int", AgnosticBackend::Indexable::FieldType::DOUBLE => "double", AgnosticBackend::Indexable::FieldType::BOOLEAN => "literal", AgnosticBackend::Indexable::FieldType::TEXT => "text", AgnosticBackend::Indexable::FieldType::TEXT_ARRAY => "text-array", }.freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #define_in_domain(index:) ⇒ Object
- #equal_to_remote_field?(remote_field) ⇒ Boolean
- #facetable? ⇒ Boolean
-
#initialize(name, type) ⇒ IndexField
constructor
A new instance of IndexField.
- #returnable? ⇒ Boolean
- #searchable? ⇒ Boolean
- #sortable? ⇒ Boolean
Methods included from Utilities
Constructor Details
#initialize(name, type) ⇒ IndexField
Returns a new instance of IndexField.
22 23 24 25 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 22 def initialize(name, type) @name = name @type = type end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 20 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
20 21 22 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 20 def type @type end |
Instance Method Details
#define_in_domain(index:) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 27 def define_in_domain(index: ) with_exponential_backoff Aws::CloudSearch::Errors::Throttling do index.cloudsearch_client.define_index_field( :domain_name => index.domain_name, :index_field => definition ) end end |
#equal_to_remote_field?(remote_field) ⇒ Boolean
36 37 38 39 40 41 42 43 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 36 def equal_to_remote_field?(remote_field) = remote_field.send(.to_sym) = remote_field.index_field_name == name.to_s && remote_field.index_field_type == cloudsearch_type && .all?{|k, v| v == .send(k) } end |
#facetable? ⇒ Boolean
57 58 59 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 57 def facetable? type.has_option(:facetable) ? !!type.get_option(:facetable) : false end |
#returnable? ⇒ Boolean
53 54 55 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 53 def returnable? type.has_option(:returnable) ? !!type.get_option(:returnable) : true end |
#searchable? ⇒ Boolean
49 50 51 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 49 def searchable? type.has_option(:searchable) ? !!type.get_option(:searchable) : true end |
#sortable? ⇒ Boolean
45 46 47 |
# File 'lib/agnostic_backend/cloudsearch/index_field.rb', line 45 def sortable? type.has_option(:sortable) ? !!type.get_option(:sortable) : true end |