[patch] regular expression field lookups
|Reported by:||Tom Tobin <korpios@…>||Owned by:||adrian|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The attached patch implements regular expression field lookups against r2487 of trunk.
The lookups are performed via "fieldname__regex" or "fieldname__iregex" for case-sensitive and -insensitive matching, respectively.
Only PostgreSQL implements case-sensitive matching; for all other databases, case-insensitive matching is performed regardless of which type is specified.
Only PostgreSQL (assuming system defaults) and sqlite implement PCRE-ish "advanced" regular expressions; the other databases only support POSIX "extended" regular expressions.
MSSQL/Transact-SQL does not implement regular expressions (as far as I can tell from the documentation available at MSDN); attempting to use regex or iregex field lookups with this backend will raise a NotImplementedError.
Regular expression searches can be performed through the admin interface by prepending and appending a slash ("/") character to the search term (e.g., /like this/). This is backwards-incompatible, but with a low chance of collision with existing usage (i.e., it's unlikely that a user is going to input a search phrase both beginning and ending with a slash; I considered adding a toggle for this behavior in settings.py, but decided against it for the time being).
Change History (16)
Changed 10 years ago by Tom Tobin <korpios@…>
comment:1 Changed 9 years ago by adrian
- priority changed from normal to low
- Severity changed from normal to minor
comment:2 Changed 9 years ago by SmileyChris
- Triage Stage changed from Unreviewed to Design decision needed