Created
October 10, 2019 16:31
-
-
Save YarikST/16364405a2f4a342702e5ae807d7e5ab 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
#More detali safepal | |
SELECT setweight(to_tsvector('title'), 'A') || | |
setweight(to_tsvector('keyword'), 'B'); | |
SELECT to_tsquery('keyword | title:A'); | |
SELECT setweight(to_tsvector('title'), 'A') || | |
setweight(to_tsvector('keyword'), 'B') @@ to_tsquery('keyword | title:C'); | |
SELECT setweight(to_tsvector('title'), 'A') @@ to_tsquery('title:A'); | |
SELECT ts_headline('sadsad keyword sa tit dfds titleas asd title' , to_tsquery('keyword | tit:*'), 'StartSel = <, StopSel = >') | |
SELECT regexp_matches( | |
'foobarbequebazilbarfbonk', '(b[^b]+)(b[^b]+)', 'g'); | |
SELECT regexp_matches( | |
'123 12 1234 1', '((\d+) (\d+))+', 'g'); | |
SELECT regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '<[^<>]+>', 'g'); | |
SELECT regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '(<[^<>]+>)', 'g'); | |
SELECT regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '[^<>]*(<[^<>]+>)[^<>]*', 'g'); | |
SELECT unnest(regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '<[^<>]+>', 'g')); | |
SELECT array_agg(regexp_matches.*) | |
FROM regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '<[^<>]+>', 'g') regexp_matches; | |
SELECT array_agg(unnest.e) FROM (Select unnest(regexp_matches(ts_headline('sadsad keyword sa tit dfds titleas asd title', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '<[^<>]+>', 'g')) as e) unnest | |
SELECT coalesce(array_agg(unnest.e), '{}') FROM (Select unnest(regexp_matches(ts_headline('sadsad s asd fdfs', to_tsquery('keyword | tit:*'), | |
'StartSel = <, StopSel = >'), '<[^<>]+>', 'g')) as e) unnest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment