Full-Text Search in Django Rest Framework
Asked Answered
F

1

5

I followed the docs and it's almost work well but when I use Full-text Search i got an error:

Unsupported lookup 'search' for CharField or join on the field not permitted

How can I fix it?

Forestation answered 1/11, 2019 at 17:54 Comment(2)
Need some code of the viewset.Aquavit
Oh I received a notification that SearchFilter docs for full-text search are outdated. I don't know if there's any other wayForestation
I
6

As reported in the DRF Search Filter documentations:

"The SearchFilter class supports simple single query parameter based searching, and is based on the Django admin's search functionality."

So if you want to implement a complete Full-text Search with Django and PostgreSQL you can read the official documentation about the full-text search.

If you are interested about external article about that here it's one I wrote: Full-Text Search in Django with PostgreSQL

Inspirational answered 4/11, 2019 at 7:44 Comment(3)
Okay ! I will try it. Thank you so much ^^Forestation
@phuc-nguyen If you think my answer helped you can vote and select it. Thanks.Inspirational
What index is needed when using DRF SearchFilter ? I cant seem to find the right one. I've tried using Gin index but upon manually querying the one being used by SearchFilter it is still being retrieved via Sequential Scan. Any ideas on this?Sandysandye

© 2022 - 2024 — McMap. All rights reserved.