You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align SearchFilter behaviour to django.contrib.admin search (encode#9017)
* Use subquery to remove duplicates in SearchFilter
* Align SearchFilter behaviour to django.contrib.admin
* Add compatibility with older django/python versions
* Allow search to split also by comma after smart split
* Use generator to build search conditions to reduce iterations
* Improve search documentation
* Update docs/api-guide/filtering.md
---------
Co-authored-by: Asif Saif Uddin <[email protected]>
For [JSONField][JSONField] and [HStoreField][HStoreField] fields you can filter based on nested values within the data structure using the same double-underscore notation:
By default, searches will use case-insensitive partial matches. The search parameter may contain multiple search terms, which should be whitespace and/or comma separated. If multiple search terms are used then objects will be returned in the list only if all the provided terms are matched.
221
+
By default, searches will use case-insensitive partial matches. The search parameter may contain multiple search terms, which should be whitespace and/or comma separated. If multiple search terms are used then objects will be returned in the list only if all the provided terms are matched. Searches may contain _quoted phrases_ with spaces, each phrase is considered as a single search term.
222
+
222
223
223
-
The search behavior may be restricted by prepending various characters to the `search_fields`.
224
+
The search behavior may be specified by prefixing field names in `search_fields` with one of the following characters (which is equivalent to adding `__<lookup>` to the field):
224
225
225
-
* '^' Starts-with search.
226
-
* '=' Exact matches.
227
-
* '@' Full-text search. (Currently only supported Django's [PostgreSQL backend][postgres-search].)
228
-
* '$' Regex search.
226
+
| Prefix | Lookup ||
227
+
| ------ | --------------| ------------------ |
228
+
|`^`|`istartswith`| Starts-with search.|
229
+
|`=`|`iexact`| Exact matches. |
230
+
|`$`|`iregex`| Regex search. |
231
+
|`@`|`search`| Full-text search (Currently only supported Django's [PostgreSQL backend][postgres-search]). |
0 commit comments