Skip to content

Commit

Permalink
Don't emit Ruby warnings when requiring opensearch-dsl (#231)
Browse files Browse the repository at this point in the history
Previous output:
```
$ RUBYOPT=-w bundle exec irb
irb(main):001> require "opensearch-dsl"
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old fields
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of fields was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old script_fields
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of script_fields was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old fielddata_fields
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of fielddata_fields was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old rescore
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of rescore was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old explain
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of explain was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old version
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of version was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old indices_boost
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of indices_boost was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old track_scores
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of track_scores was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old min_score
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of min_score was here
opensearch-ruby/lib/opensearch/dsl/search/options.rb:59: warning: method redefined; discarding old track_total_hits
opensearch-ruby/lib/opensearch/dsl/search/options.rb:55: warning: previous definition of track_total_hits was here
opensearch-ruby/lib/opensearch/dsl/search/base_component.rb:75: warning: method redefined; discarding old max_expansions
opensearch-ruby/lib/opensearch/dsl/search/base_component.rb:75: warning: previous definition of max_expansions was here
=> true
```

Signed-off-by: Earlopain <[email protected]>
  • Loading branch information
Earlopain authored Mar 3, 2024
1 parent b1246f8 commit 136e1c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Don't emit Ruby warnings when requiring `opensearch-dsl` ([#231](https://github.com/opensearch-project/opensearch-ruby/issues/231))
### Security

## [3.2.0]
Expand Down
6 changes: 3 additions & 3 deletions lib/opensearch/dsl/search/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def initialize(*_args)
define_method name do |*args|
@hash[name] = args.pop
end
end

define_method name.to_s.gsub(/^_(.*)/, '\1') do |*args|
@hash[name] = args.pop
end
def source(*args)
@hash[:_source] = args.pop
end

# Returns true when there are no search options defined
Expand Down
1 change: 0 additions & 1 deletion lib/opensearch/dsl/search/queries/match.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class Match
option_method :lenient
option_method :zero_terms_query
option_method :cutoff_frequency
option_method :max_expansions
end
end
end
Expand Down

0 comments on commit 136e1c9

Please sign in to comment.