Cheat Sheet

Tuesday, June 7, 2016

plainto_or_tsquery

CREATE OR REPLACE FUNCTION plainto_or_tsquery (TEXT) RETURNS tsquery AS $$
SELECT to_tsquery (regexp_replace ($1, E ' [\\s \' | :& ()!] + ', ' | ', ' g '));
$$ LANGUAGE SQL STRICT IMMUTABLE;
source: http://www.progtown.com/topic700061-selection-of-keywords-to-the-text.html

No comments:

Post a Comment