Wednesday, February 24, 2021

Pg Full Text search in the ORM

Hi, does anyone know how to translate the following query to the ORM?

select * from company where to_tsvector(name) @@ to_tsquery('gold:*')

So far I have the following, but cannot seem to integrate the [:*] piece.

Company.objects.annotate(search = SearchVector('name')).filter(search = SearchQuery('gold'))


TIA


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMZO7wK99QAXeoEQCxCcyFc9RMvOQ_YPpmfn4m2o7rFT6UNvhg%40mail.gmail.com.

No comments:

Post a Comment