Fix fulltext indexing

master
Vitaliy Filippov 2019-05-21 00:48:09 +03:00
parent 0058d37543
commit b304ddd5bb
2 changed files with 3 additions and 3 deletions

View File

@ -632,7 +632,7 @@ class Syncer
let upd = {
body_text: obj.text||'',
body_html: obj.html,
body_html_text: obj.html.replace(/<style[^>]*>.*<\/style\s*>|<\/?[^>]*>/g, ''),
body_html_text: obj.html.replace(/<style[^>]*>[\s\S]*?<\/style\s*>|<\/?[^>]*>/g, ''),
};
await SQL.update(
this.pg, 'messages m', {

View File

@ -81,8 +81,8 @@ begin
coalesce(msg.props->>'to', '') || ' ' ||
coalesce(msg.props->>'cc', '') || ' ' ||
coalesce(msg.props->>'bcc', '') || ' ' ||
(select string_agg((a->>'name') || ' ' || (a->>'mimetype') || ' ' || (a->>'size'), ' ')
from jsonb_array_values(coalesce(msg.props->'attachments', '[]'::jsonb)) as t (a)) || ' ' ||
coalesce((select string_agg((a->>'name') || ' ' || (a->>'mimetype') || ' ' || (a->>'size'), ' ')
from jsonb_array_elements(coalesce(msg.props->'attachments', '[]'::jsonb)) as t (a)), '') || ' ' ||
msg.subject,
'\W+', ' ', 'g'
)), 'A')