On Apr 29, 2011, at 1:55 PM, Mihir wrote:

>  @classmethod
>    def fulltext_adv(cls, search_string, raw_search=''):
>        q = Session.query(cls)
>        text_query = func.to_tsquery(search_string).alias('query')
>        q = q.filter(cls.tsv.op('@@')(text_query))
>        if raw_search:
>            q = q.order_by(Product.name.op('ilike')(raw_search +
> '%').desc())
>        q = q.order_by(sa.desc(func.ts_rank_cd(cls.tsv,
> sa.literal_column('query'), 1)))
>        return q
> 
> AttributeError: Element to_tsquery(:to_tsquery_1) does not support
> 'as_scalar()'

you probably don't want to call "alias('query')" on the func.to_tsquery() 
object.   that turns it into an aliased SELECT construct that isn't 
particularly appropriate to pass to an operator ('@@' above).

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to