Class: Eson::Search::FieldBased

Inherits:
Object
  • Object
show all
Defined in:
lib/eson/search/field_based.rb

Direct Known Subclasses

Exists, Match, Prefix, SpanTerm, Term, Wildcard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FieldBased

Returns a new instance of FieldBased.



7
8
9
10
11
12
13
# File 'lib/eson/search/field_based.rb', line 7

def initialize(*args)
  if args.length == 1
    self.options = args.first
  else
    self.field = QueryField.new(*args)
  end
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



4
5
6
# File 'lib/eson/search/field_based.rb', line 4

def field
  @field
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/eson/search/field_based.rb', line 5

def options
  @options
end

Instance Method Details

#to_query_hashObject



15
16
17
18
19
20
21
# File 'lib/eson/search/field_based.rb', line 15

def to_query_hash
  if field
    field.to_query_hash
  else
    {name => options}
  end
end