search vector
Use a type tsvectorthat is part of the PostgreSQL text search function.
postgres> select 'What are Q-type Operations?'::tsvector;
tsvector
-------------------------------------
'Operations?' 'Q-type' 'What' 'are'
(1 row)
You can also use familiar tsvectors operators:
postgres> select 'What are Q-type Operations?'::tsvector
postgres> || 'A.B.C' of Coding'::tsvector;
?column?
--------------------------------------------------------------
'A.B.C''s' 'Coding' 'Operations?' 'Q-type' 'What' 'are' 'of'
From the tsvector documentation:
tsvector , ( . 12).
, , ( "the", "a" ..) , to_tsvector. :
postgres> select to_tsvector('english',
postgres> 'What are Q-type Operations? A.B.C' of Coding');
to_tsvector
--------------------------------------------------------
'a.b.c':7 'code':10 'oper':6 'q':4 'q-type':3 'type':5
(1 row)
, - tsvector ts_query() . GiST tsvector.
postgres> insert into text (phrase, tsvec)
postgres> values('What are Q-type Operations?',
postgres> to_tsvector('english', 'What are Q-type Operations?'));
INSERT 0 1
tsquery @@:
postgres> select phrase from text where tsvec @@ to_tsquery('q-type');
phrase
-----------------------------
What are Q-type Operations?
(1 row)