I\'m trying to build a search system, and I want to search by multiple fieldsname, state, city,
in my django models. I wrote the below code, yet I\'ve been unab
EDIT: Just noticed it is Postgres only
Apparently in django 1.10 SearchVector class was added.
Usage from the docs:
Searching against a single field is great but rather limiting. The Entry instances we’re searching belong to a Blog, which has a tagline field. To query against both fields, use a SearchVector:
>>> from django.contrib.postgres.search import SearchVector
>>> Entry.objects.annotate(
... search=SearchVector('body_text', 'blog__tagline'),
... ).filter(search='Cheese')
[, ]