diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2015-06-05 12:31:44 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-02 14:41:56 -0500 |
| commit | 8ddc79a7991685b9463b4f4db43fc4c064bc49f8 (patch) | |
| tree | 5edc9b85ec7ab1df1a30d210b061f20afd59adaa /docs | |
| parent | 04240b23658f8935bbfebacccc23b5e47a1d6c22 (diff) | |
Fixed #26285 -- Deprecated the MySQL-specific __search lookup.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/internals/deprecation.txt | 3 | ||||
| -rw-r--r-- | docs/ref/models/fields.txt | 11 | ||||
| -rw-r--r-- | docs/ref/models/querysets.txt | 5 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 22 |
4 files changed, 32 insertions, 9 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 81e3600bce..2da4b6d6bb 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -141,6 +141,9 @@ details on these changes. * Support for query lookups using the model name when ``Meta.default_related_name`` is set will be removed. +* The ``__search`` query lookup and the + ``DatabaseOperations.fulltext_search_sql()`` method will be removed. + .. _deprecation-removed-in-1.10: 1.10 diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 8a348f092e..21409f562b 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1847,15 +1847,8 @@ Field API reference .. method:: get_prep_lookup(lookup_type, value) Prepares ``value`` to the database prior to be used in a lookup. - The ``lookup_type`` will be one of the valid Django filter lookups: - ``"exact"``, ``"iexact"``, ``"contains"``, ``"icontains"``, - ``"gt"``, ``"gte"``, ``"lt"``, ``"lte"``, ``"in"``, ``"startswith"``, - ``"istartswith"``, ``"endswith"``, ``"iendswith"``, ``"range"``, - ``"year"``, ``"month"``, ``"day"``, ``"isnull"``, ``"search"``, - ``"regex"``, and ``"iregex"``. - - If you are using :doc:`Custom lookups </ref/models/lookups>` the - ``lookup_type`` can be any ``lookup_name`` registered in the field. + The ``lookup_type`` will be the registered name of the lookup. For + example: ``"exact"``, ``"iexact"``, or ``"contains"``. See :ref:`preparing-values-for-use-in-database-lookups` for usage. diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 8781c4cdd4..6bb8cf81ce 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2771,6 +2771,11 @@ SQL equivalent:: ``search`` ~~~~~~~~~~ +.. deprecated:: 1.10 + + See :ref:`the 1.10 release notes <search-lookup-replacement>` for how to + replace it. + A boolean full-text search, taking advantage of full-text indexing. This is like :lookup:`contains` but is significantly faster due to full-text indexing. diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 6df47d1f82..1f2ddd9457 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -740,6 +740,28 @@ use the default_related_name ``bars``:: >>> Foo.object.get(bars=bar) +.. _search-lookup-replacement: + +``__search`` query lookup +------------------------- + +The ``search`` lookup, which supports MySQL only and is extremely limited in +features, is deprecated. Replace it with a custom lookup:: + + from django.db import models + + class Search(models.Lookup): + lookup_name = 'search' + + def as_mysql(self, compiler, connection): + lhs, lhs_params = self.process_lhs(compiler, connection) + rhs, rhs_params = self.process_rhs(compiler, connection) + params = lhs_params + rhs_params + return 'MATCH (%s) AGAINST (%s IN BOOLEAN MODE)' % (lhs, rhs), params + + models.CharField.register_lookup(Search) + models.TextField.register_lookup(Search) + Miscellaneous ------------- |
