Method: MarkLogic::Queries::WordQuery#options

Defined in:
lib/marklogic/queries/word_query.rb

#optionsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/marklogic/queries/word_query.rb', line 11

def options
  opts = []
  @options.each do |k, v|
    dashed_key = k.to_s.gsub(/_/, '-')
    case k.to_s
    when "lang", "distance_weight", "min_occurs", "max_occurs", "lexicon_expand"
      opts << %Q{"#{dashed_key}=#{v}"}
    when /(case|diacritic|punctuation|whitespace)_sensitive/
      opts << (v == true ? %Q{"#{$1}-sensitive"} : %Q{"#{$1}-insensitive"})
    when "exact"
      opts << %Q{"#{dashed_key}"}
    when "stemmed", "wildcarded"
      opts << (v == true ? %Q{"#{dashed_key}"} : %Q{"un#{dashed_key}"})
    else
      opts << %Q{"#{v}"}
    end
  end

  opts
end