chore: Search optimisations (#6644)
- Strip search term before searching - order messages by created_at desc - order contacts by last_activity_at desc - order conversations by created_at desc - Search only resolved contacts - Optimize resolved contacts query ref: #6583
This commit is contained in:
@@ -136,9 +136,7 @@ class Contact < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.resolved_contacts
|
||||
where.not(email: [nil, '']).or(
|
||||
Current.account.contacts.where.not(phone_number: [nil, ''])
|
||||
).or(Current.account.contacts.where.not(identifier: [nil, '']))
|
||||
where("COALESCE(NULLIF(contacts.email,''),NULLIF(contacts.phone_number,''),NULLIF(contacts.identifier,'')) IS NOT NULL")
|
||||
end
|
||||
|
||||
def discard_invalid_attrs
|
||||
|
||||
Reference in New Issue
Block a user