#2559 closed enhancement (fixed)
[patch] Operators for search_fields
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | farcepest@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently, search_fields in Admin always do an icontains search, i.e. ILIKE %...% search where ... is the search term. This is inefficient and undesirable in many cases because you cannot use an index and the database must search all rows.
The following patch (to be attached) extends this to add the following prefix operators and corresponding searches:
^
: istartswith=
: iexact@
: search (full-text)- no prefix: icontains (current behavior)
My tests indicate ^
makes my searches a lot faster. However, if there is at least one search field without a prefix, the database will still have to check every row.
Attachments (4)
Change History (7)
by , 18 years ago
Attachment: | django-search_fields-operators.diff added |
---|
comment:1 by , 18 years ago
Summary: | Operators for search_fields → [patch] Operators for search_fields |
---|
by , 18 years ago
Attachment: | django-search_fields-operators_pre_magic_removal.diff added |
---|
The same patch back-ported to the pre-magic-removal tag (changeset r2808)
by , 18 years ago
Attachment: | django-search_fields-operators-docs_pre_magic_removal.diff added |
---|
The same patch back-ported to the pre-magic-removal tag (changeset r2808)
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 17 years ago
Version: | → SVN |
---|
search_fields one filed multivalue search bug?
http://code.djangoproject.com/ticket/4977
Implementation