Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE INDEX pgweb_idx ON pgweb
- USING gin(to_tsvector('english', title || ' ' || body));
- ... WHERE
- (to_tsvector('english', title||' '||body) @@ to_tsquery('english', 'foo'))
- ... WHERE
- (to_tsvector('english', title) @@ to_tsquery('english','foo'))
- OR
- (to_tsvector('english', body) @@ to_tsquery('english','foo'))
- --search any "field" for quick:
- select 'quick:1A brown:2B quick:3C'::tsvector @@ 'quick'::tsquery; --true
- --search B "field" for quick:
- select 'quick:1A brown:2B quick:3C'::tsvector @@ 'quick:B'::tsquery; --false
- --search B or C "fields" for quick:
- select 'quick:1A brown:2B quick:3C'::tsvector @@ 'quick:BC'::tsquery; --true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement