[Django]-Django rest framework search filter all fields

5👍

Not possible and it’s not a good idea anyway..

One reason is because there can be different types of searching query (__istartswith, __iexact, etc.), which you can set up for each field name.

You can also have different field types which won’t necessary support text-base search.

More important – it will result in much slower queries, while you keep adding new fields into the model. It’s always better to be explicit, so you know which fields are actually searched upon.

If your searching feature relies on multiple fields, maybe you should consider haystack or look for any other dedicated searching engine.

Leave a comment