0
我在我的Rails 4應用程序上使用PgSearch。一直在試圖找出如何在返回搜索結果時提升精確匹配。PG搜索不返回精確匹配首先 - Rails 4
目前,如果用戶搜索「焦炭」... ...「焦炭零」將首先顯示...然後是「可樂」。我想「可樂」是第一位的。
這裏是我的代碼:
include PgSearch
pg_search_scope :search, :against => { :specific => 'A', :title => 'B', :aka => 'C'},
:using => { dmetaphone: {}, tsearch: { dictionary: 'english' },
trigram: {:threshold => 0.3} },
ignoring: :accents
任何幫助深表感謝。
感謝您的幫助。最終成爲我默認的範圍,我愚蠢地俯瞰。 @sadaf – Kathan