-
-
Save matteomanzo/8446ae18a4e1ef4c9768c8f76e1fe2dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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