This has changed since @stalk responded. Starting with Django 1.10 , the Django Rest Framework can also support PostgreSQL.
And since django.contrib.postgres provides the same __search interface as MySQL does, you can connect your API to Postgres using the same setup as for MySQL:
- Add
django.contrib.postgres to your INSTALLED_APPS . In your view, use the @ symbol to mark full-text search fields:
search_fields = ('@title', '@description')
In fact, it seems that Django's full-text search support for MySQL is deprecated or at least changing, according to the note about deprecating the Django docs link in the original @stalk answer. This note refers to the following explanation, which also contains sample code to replace it:
Search in search engines that only supports MySQL and is extremely feature-limited is outdated. Replace it with a normal search ...
Sorry, I don't have enough reputation to post additional direct links.
source share