searching failing in multiple scenarios
See original GitHub issueI’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?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (6 by maintainers)
Top Results From Across the Web
How to test failure scenarios! - Yellow Bricks
I usually ask first if there's a diagram that shows the current configuration. The answer is usually no. Then I would ask if...
Read more >how to continue with next scenario in case of a Failure
(FYI I have multiple feature files...and each file has multiple scenarios). However even with my current approach if one test fails the rest...
Read more >Multiple examples in scenario outline gives error(Missing EOF ...
Problem Statement : -> I have multiple scenarios outline so i want when my scenario 1 will run with first row data set...
Read more >20 Scenarios for Testing login Pages & Search Functionalities
In this blog, we provide a handy list of 20+ test scenarios which are a must-add to the list of test cases –...
Read more >Certain search scenario can't return expected result in Outlook ...
A certain search condition fails to provide expected results when you use Outlook online mode in Microsoft Exchange Server 2019. For example, you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe I’m experiencing a similar issue, but not with foreign objects, but calculated fields on the object. For example, I have a calculated field that checks all of the foreignkey objects for the latest entry, and failing to find that, defaults to a field on the object itself.
So I have a method on the object called ‘get_medals’ – Search and sort are both failing because it can’t find that field on the model.
Thanks to @TauPan, DRFD now fully supports django-filter. I’m closing this issue, basic filtering is good enough for small projects, and more complex filtering can no be done quite simply with django-filter.