Created
February 17, 2015 07:40
-
-
Save NuckChorris/5b3502a8a35882161a98 to your computer and use it in GitHub Desktop.
This file contains 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
class Anime | |
pg_search_scope :search, | |
against: { title: 'A', alt_title: 'A', synopsis: 'C' }, | |
using: { | |
tsearch: { | |
prefix: true, | |
# Normalize to string length and scale to 0..1 | |
normalization: 32, | |
dictionary: 'english' | |
}, | |
trigram: { | |
only: [:title, :alt_title], | |
} | |
}, | |
# Combine trigram and tsearch values | |
ranked_by: ':trigram + :tsearch' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment