Module: ElasticsearchRecord::Relation::ValueMethods

Defined in:
lib/elasticsearch_record/relation/value_methods.rb

Instance Method Summary collapse

Instance Method Details

#aggs_clauseObject



36
37
38
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 36

def aggs_clause
  @values.fetch(:aggs, ElasticsearchRecord::Relation::QueryClauseTree.empty)
end

#aggs_clause=(value) ⇒ Object



40
41
42
43
44
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 40

def aggs_clause=(value)
  assert_mutability!

  @values[:aggs] = value
end

#configure_valueObject



16
17
18
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 16

def configure_value
  @values.fetch(:configure, {})
end

#configure_value=(value) ⇒ Object



20
21
22
23
24
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 20

def configure_value=(value)
  assert_mutability!

  @values[:configure] = value
end

#kind_valueObject

holds the query kind



5
6
7
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 5

def kind_value
  @values.fetch(:kind, nil)
end

#kind_value=(value) ⇒ Object



9
10
11
12
13
14
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 9

def kind_value=(value)
  # checks if records are already loaded - in this case we cannot mutate the query anymore
  assert_mutability!

  @values[:kind] = value.to_sym
end

#limit_value=(limit) ⇒ Object

overwrite the limit_value setter, to provide a special behaviour of auto-setting the +max_result_window+.



47
48
49
50
51
52
53
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 47

def limit_value=(limit)
  if limit == '__max__' || (limit.nil? && delegate_query_nil_limit?)
    super(max_result_window)
  else
    super(limit)
  end
end

#query_clauseObject



26
27
28
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 26

def query_clause
  @values.fetch(:query, ElasticsearchRecord::Relation::QueryClauseTree.empty)
end

#query_clause=(value) ⇒ Object



30
31
32
33
34
# File 'lib/elasticsearch_record/relation/value_methods.rb', line 30

def query_clause=(value)
  assert_mutability!

  @values[:query] = value
end