Files
chatwoot/lib/chatwoot_app.rb
Pranav 0c2ab7f5e7 feat(ee): Setup advanced, performant message search (#12193)
We now support searching within the actual message content, email
subject lines, and audio transcriptions. This enables a faster, more
accurate search experience going forward. Unlike the standard message
search, which is limited to the last 3 months, this search has no time
restrictions.

The search engine also accounts for small variations in queries. Minor
spelling mistakes, such as searching for slck instead of Slack, will
still return the correct results. It also ignores differences in accents
and diacritics, so searching for Deja vu will match content containing
Déjà vu.


We can also refine searches in the future by criteria such as:
- Searching within a specific inbox
- Filtering by sender or recipient
- Limiting to messages sent by an agent


Fixes https://github.com/chatwoot/chatwoot/issues/11656
Fixes https://github.com/chatwoot/chatwoot/issues/10669
Fixes https://github.com/chatwoot/chatwoot/issues/5910



---

Rake tasks to reindex all the messages. 

```sh
bundle exec rake search:all
```

Rake task to reindex messages from one account only
```sh
bundle exec rake search:account ACCOUNT_ID=1
```
2025-08-28 10:10:28 +05:30

46 lines
848 B
Ruby

# frozen_string_literal: true
require 'pathname'
module ChatwootApp
def self.root
Pathname.new(File.expand_path('..', __dir__))
end
def self.max_limit
100_000
end
def self.enterprise?
return if ENV.fetch('DISABLE_ENTERPRISE', false)
@enterprise ||= root.join('enterprise').exist?
end
def self.chatwoot_cloud?
enterprise? && GlobalConfig.get_value('DEPLOYMENT_ENV') == 'cloud'
end
def self.custom?
@custom ||= root.join('custom').exist?
end
def self.help_center_root
ENV.fetch('HELPCENTER_URL', nil) || ENV.fetch('FRONTEND_URL', nil)
end
def self.extensions
if custom?
%w[enterprise custom]
elsif enterprise?
%w[enterprise]
else
%w[]
end
end
def self.advanced_search_allowed?
enterprise? && ENV.fetch('OPENSEARCH_URL', nil).present?
end
end