Skip to content

searching failing in multiple scenarios #13

@jerzyk

Description

@jerzyk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions