On Tuesday, August 13, 2019 at 1:05:12 PM UTC-7, xura wrote:
>
> Hi,
>
> How can I translate this query to Sequel/Ruby? Does Sequel has ability to 
> handle such queries or do i need to execute raw?
>
> SELECT * FROM contacts WHERE to_tsvector('English', addresses ->> 
> 'address') @@ to_tsquery('Heimdall')
>
>
Here's something fairly similar:

 Sequel.extension :pg_json_ops
DB[:contacts].full_text_search(Sequel.pg_json_op(:addresses).get_text('address'),
 
'Heimdall', :language=>'English')

SELECT * FROM "contacts" WHERE (to_tsvector(CAST('English' AS regconfig), 
(COALESCE(("addresses" ->> 'address'), ''))) @@ to_tsquery(CAST('English' 
AS regconfig), 'Heimdall'))

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/3ac9df25-9ce2-4586-95a2-d66f2503d2d4%40googlegroups.com.

Reply via email to