Last active
August 20, 2017 16:30
-
-
Save baditaflorin/b1dc5c466abf9c214f7c8583bd9a72f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select s.*,tag_name,title,mps.user_username,post_tags,article_url from ( | |
SELECT post_id,ts_headline(text, keywords, 'MaxFragments=35,MaxWords=50,MinWords=6') as result | |
-- tweak the setting to reflect what you want. the text column is where i have the text | |
FROM medium_posts_text mptxt, plainto_tsquery('pg_catalog.english','training') as keywords | |
--change bot with the word that you are searching | |
WHERE to_tsvector(text) @@ keywords | |
) s | |
inner join medium_posts_tags mpt on mpt.post_id = s.post_id | |
inner join medium_posts_stats mps on mps.post_id = s.post_id | |
wHERE tag_name ilike 'Artificial Intelligence' or mpt.tag_name ilike 'Machine Learning' or mpt.tag_name ilike 'Deep Learning' | |
-- filter and keep just the tags that you want | |
limit 5000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment