Module: Swiftype::Search

Included in:
DocumentType, Easy
Defined in:
lib/swiftype/search.rb

Constant Summary collapse

VALID_SUGGEST_OPTIONS =
[:fetch_fields, :search_fields, :filters, :document_types, :functional_boosts, :page, :per_page]
VALID_SEARCH_OPTIONS =
[:fetch_fields, :search_fields, :filters, :document_types, :functional_boosts, :page, :per_page, :sort_field, :sort_direction]

Instance Method Summary collapse

Instance Method Details

#parse_options(options, valid_options) ⇒ Object



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

def parse_options(options, valid_options)
  parsed_options = {}
  valid_options.each do |option_name|
    next unless options[option_name]
    parsed_options[option_name] = options[option_name]
  end
  parsed_options
end

#parse_search_options(options) ⇒ Object



6
7
8
# File 'lib/swiftype/search.rb', line 6

def parse_search_options(options)
  parse_options(options, VALID_SEARCH_OPTIONS)
end

#parse_suggest_options(options) ⇒ Object



10
11
12
# File 'lib/swiftype/search.rb', line 10

def parse_suggest_options(options)
  parse_options(options, VALID_SUGGEST_OPTIONS)
end