Ejemplo n.º 1
0
 def test_concatenate_search_vectors(self):
     assert str(
         tsvector_match(
             tsvector_concat(self.Article.search_vector,
                             self.Article.search_vector2),
             to_tsquery('finnish', 'something'),
         )) == ('(article.search_vector || article.search_vector2) '
                '@@ to_tsquery(:to_tsquery_1, :to_tsquery_2)')
Ejemplo n.º 2
0
 def test_concatenate_search_vectors(self):
     assert str(tsvector_match(
         tsvector_concat(
             self.Article.search_vector,
             self.Article.search_vector2
         ),
         to_tsquery('finnish', 'something'),
     )) == (
         '(article.search_vector || article.search_vector2) '
         '@@ to_tsquery(:to_tsquery_1, :to_tsquery_2)'
     )
Ejemplo n.º 3
0
        def match_tsquery(self, other, catalog=None):
            from sqlalchemy_utils.expressions import tsvector_match, to_tsquery

            args = []
            if catalog:
                args.append(catalog)
            elif self.type.options.get('catalog'):
                args.append(self.type.options.get('catalog'))
            args.append(other)

            return tsvector_match(self.expr, to_tsquery(*args))
Ejemplo n.º 4
0
        def match_tsquery(self, other, catalog=None):
            from sqlalchemy_utils.expressions import tsvector_match, to_tsquery

            args = []
            if catalog:
                args.append(catalog)
            elif self.type.options.get('catalog'):
                args.append(self.type.options.get('catalog'))
            args.append(other)

            return tsvector_match(
                self.expr,
                to_tsquery(*args)
            )
Ejemplo n.º 5
0
 def test_supports_postgres(self):
     assert str(to_tsquery('something')) == 'to_tsquery(:to_tsquery_1)'
Ejemplo n.º 6
0
 def test_requires_atleast_one_parameter(self):
     with raises(Exception):
         str(to_tsquery())
Ejemplo n.º 7
0
 def test_supports_postgres(self):
     assert str(
         tsvector_match(
             self.Article.search_vector,
             to_tsquery('something'),
         )) == '(article.search_vector) @@ to_tsquery(:to_tsquery_1)'
Ejemplo n.º 8
0
 def test_supports_postgres(self):
     assert str(to_tsquery('something')) == 'to_tsquery(:to_tsquery_1)'
Ejemplo n.º 9
0
 def test_requires_atleast_one_parameter(self):
     with raises(Exception):
         str(to_tsquery())
Ejemplo n.º 10
0
 def test_supports_postgres(self):
     assert str(tsvector_match(
         self.Article.search_vector,
         to_tsquery('something'),
     )) == '(article.search_vector) @@ to_tsquery(:to_tsquery_1)'