Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
module Searchable
extend ActiveSupport::Concern
included do
include PgSearch
end
class_methods do
def searchable_on(fields)
search_opts = {
against: fields,
associated_against: {
notes: [:content],
tags: [:name],
internal_tags: [:name]
},
using: {
tsearch: { any_word: true, prefix: true },
trigram: {},
dmetaphone: { any_word: true },
}
}
send(:pg_search_scope, :search, search_opts)
end
end
end