Old PostgreSQL full-text search removed
This commit is contained in:
parent
bee641baf1
commit
6c9607ffa8
1 changed files with 0 additions and 20 deletions
|
|
@ -31,24 +31,4 @@ class Package < ActiveRecord::Base
|
||||||
subselect = Screenshot.select(:package_id)
|
subselect = Screenshot.select(:package_id)
|
||||||
where.not(id: subselect)
|
where.not(id: subselect)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use PostgreSQL's full-text search capability for the user search
|
|
||||||
# TODO: check if pgSearch does this job for us
|
|
||||||
#def self.text_search(query)
|
|
||||||
# if query.present?
|
|
||||||
# # Add a rank column to each result
|
|
||||||
# rank = <<-RANK
|
|
||||||
# ts_rank(to_tsvector(packages.name), plainto_tsquery(#{sanitize(query)}))
|
|
||||||
# +
|
|
||||||
# ts_rank(to_tsvector(packages.description), plainto_tsquery(#{sanitize(query)}))
|
|
||||||
# RANK
|
|
||||||
#
|
|
||||||
# # Do the full-text search and return results by rank
|
|
||||||
# where("to_tsvector('english', packages.name) @@ plainto_tsquery(:q) or
|
|
||||||
# to_tsvector('english', packages.description) @@ plainto_tsquery(:q)
|
|
||||||
# ", q: query).order("#{rank} desc")
|
|
||||||
# else
|
|
||||||
# all
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue