Class: OpenSearch::DSL::Search::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/opensearch/dsl/search/options.rb

Overview

Wraps the “extra” options of a search definition

Constant Summary collapse

DSL_METHODS =
%i[
  _source
  fields
  script_fields
  fielddata_fields
  rescore
  explain
  version
  indices_boost
  track_scores
  min_score
  track_total_hits
]

Instance Method Summary collapse

Constructor Details

#initialize(*_args) ⇒ Options

Returns a new instance of Options.



48
49
50
# File 'lib/opensearch/dsl/search/options.rb', line 48

def initialize(*_args)
  @hash = {}
end

Instance Method Details

#empty?Boolean

Returns true when there are no search options defined

Returns:

  • (Boolean)


66
67
68
# File 'lib/opensearch/dsl/search/options.rb', line 66

def empty?
  @hash.empty?
end

#source(*args) ⇒ Object



60
61
62
# File 'lib/opensearch/dsl/search/options.rb', line 60

def source(*args)
  @hash[:_source] = args.pop
end

#to_hash(_options = {}) ⇒ Hash

Convert the definition to a Hash

Returns:

  • (Hash)


74
75
76
# File 'lib/opensearch/dsl/search/options.rb', line 74

def to_hash(_options = {})
  @hash
end