-
-
Notifications
You must be signed in to change notification settings - Fork 91
Closed
Description
I've found a multiple scenarios where existing column search is failing badly:
- search on fields that are foreign keys or numbers (eg. integers) - this will fail on "proper" databases (not sqlite)
- search on fields that are aliases to some other columns, e.g.:
detail_name = serializers.CharField(source='detail.name', read_only=True)
existing code assumes incorrectly that field name is the database field to query
most of those searches will fail twice - on "general" search - where top search field is used and then second time on the specific field
I do not have a clear idea how to resolve this, but those my first ideas:
- there should be an implementation that is similar to the existing ones - where searchable fields will be specified on python side - not pushed from request - this is potentially a security/performance leak
- there should be an option that is defining which fields are taken into account in "global" search
- there should be a detection and/or specification of default search operators per field type, where a safe options should be set as defaults (e.g. __exact or __iexact) and user could override them (eg. __icontains/__istartswith etc.)
- maybe there will be an option to use existing filtering backends in combination with this one?
hugokernel and alsoncahyadi
Metadata
Metadata
Assignees
Labels
No labels