module Chewie::Interface::FullText

Public Instance Methods

match(attribute, context: :query, clause: nil, options: {}) click to toggle source

www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html

@param attribute [Symbol] Field you wish to search @param context [Symbol] Desired context the query should appear (see www.elastic.co/guide/en/elasticsearch/reference/current/compound-queries.html) @param clause [Symbol] Specify a nested clause, usually context dependent (optional) @param options [Hash] Options to augment search behavior: www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#match-field-params @return [Hash] A valid “must” query

# File lib/chewie/interface/full_text.rb, line 11
def match(attribute, context: :query, clause: nil, options: {})
  handler = {
    query: :match,
    clause: clause,
    attribute: attribute,
    query_type: :full_text,
    options: options,
  }

  set_handler(context: context, handler: handler)
end
multimatch(with: [], context: :query, clause: nil, options: {}) click to toggle source

www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html

@param with [Array] A collection of field symbols to match against @param context [Symbol] Desired context the query should appear (see www.elastic.co/guide/en/elasticsearch/reference/current/compound-queries.html) @param clause [Symbol] Specify a nested clause, usually context dependent (optional) @param options [Hash] Options to augment search behavior @return [Hash] A valid “multi-match” query

# File lib/chewie/interface/full_text.rb, line 30
def multimatch(with: [], context: :query, clause: nil, options: {})
  if context == :compound
    raise 'Please include a :clause value for compound queries.'
  end

  handler = {
    query: :multimatch,
    clause: clause,
    with: with,
    query_type: :full_text,
    options: options,
  }

  set_handler(context: context, handler: handler)
end