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)')
 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)'
     )
Esempio 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))
Esempio 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)
            )
 def test_supports_postgres(self):
     assert str(to_tsquery('something')) == 'to_tsquery(:to_tsquery_1)'
 def test_requires_atleast_one_parameter(self):
     with raises(Exception):
         str(to_tsquery())
 def test_supports_postgres(self):
     assert str(
         tsvector_match(
             self.Article.search_vector,
             to_tsquery('something'),
         )) == '(article.search_vector) @@ to_tsquery(:to_tsquery_1)'
 def test_supports_postgres(self):
     assert str(to_tsquery('something')) == 'to_tsquery(:to_tsquery_1)'
 def test_requires_atleast_one_parameter(self):
     with raises(Exception):
         str(to_tsquery())
 def test_supports_postgres(self):
     assert str(tsvector_match(
         self.Article.search_vector,
         to_tsquery('something'),
     )) == '(article.search_vector) @@ to_tsquery(:to_tsquery_1)'