Class: Eson::Search::MoreLikeThisField

Inherits:
Object
  • Object
show all
Includes:
Query
Defined in:
lib/eson/search/more_like_this_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Query

included, #method_missing

Constructor Details

#initialize(field, options = {}) ⇒ MoreLikeThisField

Returns a new instance of MoreLikeThisField.



11
12
13
# File 'lib/eson/search/more_like_this_field.rb', line 11

def initialize(field, options = {})
  self.field = QueryField.new(field, options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Eson::Search::Query

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



9
10
11
# File 'lib/eson/search/more_like_this_field.rb', line 9

def field
  @field
end

Instance Method Details

#mlt_field { ... } ⇒ self

Generates a ‘mlt_field` query in a query context.

Yields:

  • the block containing further options and subqueries

Returns:

  • (self)

    the generated facet



7
# File 'lib/eson/search/more_like_this_field.rb', line 7

short_name :mlt_field

#to_query_hashObject



15
16
17
# File 'lib/eson/search/more_like_this_field.rb', line 15

def to_query_hash
  {name => field.to_query_hash}
end