Updated SearchService Group, PreviewCard, Tag to be limit to 25

• Updated:
- SearchService Group, PreviewCard, Tag to be limit to 25
This commit is contained in:
mgabdev
2020-11-04 13:50:39 -06:00
parent 8a1f2f2c47
commit 6e45eb18ca
4 changed files with 6 additions and 9 deletions

View File

@@ -61,12 +61,12 @@ class Group < ApplicationRecord
after_create :add_owner_to_accounts
class << self
def search_for(term, limit = 25, offset = 0)
def search_for(term, offset = 0)
pattern = sanitize_sql_like(term.strip) + '%'
Group.where('lower(title) like lower(?) AND is_archived=false AND is_visible=true', pattern)
.order('member_count DESC')
.limit(limit)
.limit(25)
.offset(offset)
end
end