Casecommons/pg_search

Is it possible to ignore accents when querying, but use them for ranking?

goulvench opened this issue · 2 comments

Hello, and thanks for this gem, which works great and has both a great API and clear documentation.

Here is a simplified version of the code I'm using to demonstrate what I'm facing:

class User < ApplicationRecord
  include PgSearch::Model
  pg_search_scope :search, against: :name, ignoring: :accents
end

User.upsert_all([{name: 'Elodie', name: 'Élodie'}])
User.search('Élodie').collect(&:name)
=> ['Elodie', 'Élodie'] # results are ranked by id ascending by default, though the second is a better match

How can I boost ranking for results where the search query matches the records without ignoring accents? Is that possible or should I sort the result set manually?

That's an interesting use case that makes sense. I am pretty sure it's not yet supported.

Did you find a solution, I'm in the same situation?