We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Postgresql and @@ expression


I need to execute query in PostgeSQL containing this condition:

to_tsvector('English', cast(client_data_original as TEXT)) @@ plainto_tsquery('English', ':cdo_ftxt:')

There are two problems:

1) Phalcon doesn't recognize parameters in functions, so I can't use

plainto_tsquery('English', ':cdo_ftxt:')

I need to set explicit value withour parametrizing it, like this:

plainto_tsquery('English', 'John Smith')

2) Second more serious problem is, that PHQL doesn't recognize @@ expressions, instead I can use function ts_match_vq, but after that, PostgreSQL is not using Fulltext index like it is using with @@ expression, so I really need PHQL to recognize @@ expression.

How can I modify PostgreSQL dialect in Phalcon source code to recognize such expressions?

It would be ideal if we have way to register custom expressions to any dialect in similar way to register functions via registerCustomFunction method.