Skip to content

Instantly share code, notes, and snippets.

@matteomanzo
Created April 18, 2018 07:49
Show Gist options
  • Save matteomanzo/8446ae18a4e1ef4c9768c8f76e1fe2dd to your computer and use it in GitHub Desktop.
Save matteomanzo/8446ae18a4e1ef4c9768c8f76e1fe2dd to your computer and use it in GitHub Desktop.
def word_weight(word)
case word
when "botteghe"
0.0
when /\Ab[ao]tte\z/
0.0
else
1.0
end
end
Mastico::Query.new(fields: [:author], query: "Botticello", word_weight: method(:word_weight)).apply(chewy_query).load.to_a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment