I'd like to have a text search that can also retrieve results matching the domain name in an email address:
Say I have this table of tweets
create table tweets (
id uuid primary key,
tweet text not null,
)
and a seeding like
insert into tweets (id,tweet) values
(gen_random_uuid(), 'Hello friends! #example-tweet'),
(gen_random_uuid(), 'Reach me out [email protected]'),
(gen_random_uuid(), 'For example, I want you to finish this'),
(gen_random_uuid(), 'James is a bad guy #james'),
(gen_random_uuid(), 'Hahaha found the email: [email protected]');
the following query does NOT list the Reach me out [email protected] as result
SELECT tweet, ts_rank_cd(to_tsvector(t.tweet), query) AS rank
FROM tweets t, to_tsquery('example') query
WHERE query @@ to_tsvector(t.tweet)
ORDER BY rank DESC
LIMIT 10;
Can I make a text search on tweets returning also email domains or internal parts of a string?