summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorNoufal Ibrahim <noufal@nibrahim.net.in>2013-12-05 18:21:49 +0530
committerNoufal Ibrahim <noufal@nibrahim.net.in>2013-12-10 01:07:36 +0530
commit4eb8437f61139179a18f63168ff9987acfd0f3ca (patch)
treece7ab115f704dccad0e434472d543ca54ad28fe7 /lib/sqlalchemy/dialects
parent96359c6f3e81f55275666e94d9b9cadb7a1d923e (diff)
downloadsqlalchemy-4eb8437f61139179a18f63168ff9987acfd0f3ca.tar.gz
Updates documentation for tsvector type.
Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 5ef16c412..ed8a8c90f 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -369,6 +369,31 @@ class UUID(sqltypes.TypeEngine):
PGUuid = UUID
class TSVECTOR(sqltypes.TypeEngine):
+ """The TSVECTOR type implements the Postgresql text search type
+ TSVECTOR.
+
+ It can be used to do full text queries on natural language
+ *documents*.
+
+ Search queries are performed using the ``@@`` operator in
+ postgresql. This is made available with the ``match`` method
+ available on the column.
+
+ This means that if you have a table ``Example`` with a column
+ ``text`` of type ``TSVECTOR``, you can create a search clause like
+ so
+
+ ::
+
+ Example.text.match("search string")
+
+ which will be compiled to
+
+ ::
+
+ text @@ to_tsquery('search string')
+
+ """
__visit_name__ = 'TSVECTOR'
@@ -1169,7 +1194,7 @@ class PGDDLCompiler(compiler.DDLCompiler):
class PGTypeCompiler(compiler.GenericTypeCompiler):
def visit_TSVECTOR(self, type):
return "TSVECTOR"
-
+
def visit_INET(self, type_):
return "INET"