summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMarc Tamlyn <marc.tamlyn@gmail.com>2015-06-05 12:31:44 +0100
committerTim Graham <timograham@gmail.com>2016-03-02 14:41:56 -0500
commit8ddc79a7991685b9463b4f4db43fc4c064bc49f8 (patch)
tree5edc9b85ec7ab1df1a30d210b061f20afd59adaa /django
parent04240b23658f8935bbfebacccc23b5e47a1d6c22 (diff)
Fixed #26285 -- Deprecated the MySQL-specific __search lookup.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/base/operations.py1
-rw-r--r--django/db/backends/mysql/operations.py1
-rw-r--r--django/db/models/lookups.py6
3 files changed, 8 insertions, 0 deletions
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index 907a59f269..e3fa8904ef 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -191,6 +191,7 @@ class BaseDatabaseOperations(object):
search of the given field_name. Note that the resulting string should
contain a '%s' placeholder for the value being searched against.
"""
+ # RemovedInDjango20Warning
raise NotImplementedError('Full-text search is not implemented for this database backend')
def last_executed_query(self, cursor, sql, params):
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py
index e71de6c4a2..8a0fe80583 100644
--- a/django/db/backends/mysql/operations.py
+++ b/django/db/backends/mysql/operations.py
@@ -91,6 +91,7 @@ class DatabaseOperations(BaseDatabaseOperations):
return [(None, ("NULL", [], False))]
def fulltext_search_sql(self, field_name):
+ # RemovedInDjango20Warning
return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
def last_executed_query(self, cursor, sql, params):
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
index 4cbf27ee56..9a7812497b 100644
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -1,3 +1,4 @@
+import warnings
from copy import copy
from django.conf import settings
@@ -7,6 +8,7 @@ from django.db.models.fields import (
)
from django.db.models.query_utils import RegisterLookupMixin
from django.utils import timezone
+from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.functional import cached_property
from django.utils.six.moves import range
@@ -373,6 +375,10 @@ class Search(BuiltinLookup):
lookup_name = 'search'
def as_sql(self, compiler, connection):
+ warnings.warn(
+ 'The `__search` lookup is deprecated. See the 1.10 release notes '
+ 'for how to replace it.', RemovedInDjango20Warning, stacklevel=2
+ )
lhs, lhs_params = self.process_lhs(compiler, connection)
rhs, rhs_params = self.process_rhs(compiler, connection)
sql_template = connection.ops.fulltext_search_sql(field_name=lhs)