Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
51398323
Kaydet (Commit)
51398323
authored
Ara 31, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #26285 -- Removed MySQL __search lookup per deprecation timeline.
üst
bfe0d545
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4 additions
and
101 deletions
+4
-101
operations.py
django/db/backends/base/operations.py
+0
-9
operations.py
django/db/backends/mysql/operations.py
+0
-4
lookups.py
django/db/models/lookups.py
+0
-18
querysets.txt
docs/ref/models/querysets.txt
+0
-27
2.0.txt
docs/releases/2.0.txt
+2
-0
models.py
tests/lookup/models.py
+0
-13
tests.py
tests/lookup/tests.py
+2
-30
No files found.
django/db/backends/base/operations.py
Dosyayı görüntüle @
51398323
...
...
@@ -191,15 +191,6 @@ class BaseDatabaseOperations(object):
else
:
return
'FOR UPDATE'
def
fulltext_search_sql
(
self
,
field_name
):
"""
Returns the SQL WHERE clause to use in order to perform a full-text
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
):
"""
Returns a string of the query last executed by the given cursor, with
...
...
django/db/backends/mysql/operations.py
Dosyayı görüntüle @
51398323
...
...
@@ -110,10 +110,6 @@ 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
):
# With MySQLdb, cursor objects have an (undocumented) "_last_executed"
# attribute where the exact query sent to the database is saved.
...
...
django/db/models/lookups.py
Dosyayı görüntüle @
51398323
import
itertools
import
math
import
warnings
from
copy
import
copy
from
decimal
import
Decimal
...
...
@@ -10,7 +9,6 @@ from django.db.models.fields import (
DateTimeField
,
DecimalField
,
Field
,
IntegerField
,
)
from
django.db.models.query_utils
import
RegisterLookupMixin
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.functional
import
cached_property
from
django.utils.six.moves
import
range
...
...
@@ -509,22 +507,6 @@ class IsNull(BuiltinLookup):
return
"
%
s IS NOT NULL"
%
sql
,
params
@Field.register_lookup
class
Search
(
BuiltinLookup
):
lookup_name
=
'search'
prepare_rhs
=
False
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
)
return
sql_template
,
lhs_params
+
rhs_params
@Field.register_lookup
class
Regex
(
BuiltinLookup
):
lookup_name
=
'regex'
...
...
docs/ref/models/querysets.txt
Dosyayı görüntüle @
51398323
...
...
@@ -2918,33 +2918,6 @@ SQL equivalent::
SELECT ... WHERE pub_date IS NULL;
.. fieldlookup:: search
``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.
Example::
Entry.objects.filter(headline__search="+Django -jazz Python")
SQL equivalent::
SELECT ... WHERE MATCH(tablename, headline) AGAINST (+Django -jazz Python IN BOOLEAN MODE);
Note this is only available in MySQL and requires direct manipulation of the
database to add the full-text index. By default Django uses BOOLEAN MODE for
full text searches. See the `MySQL documentation`_ for additional details.
.. _MySQL documentation: https://dev.mysql.com/doc/refman/en/fulltext-boolean.html
.. fieldlookup:: regex
``regex``
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
51398323
...
...
@@ -353,3 +353,5 @@ these features.
* Support for query lookups using the model name when
``Meta.default_related_name`` is set is removed.
* The MySQL ``__search`` lookup is removed.
tests/lookup/models.py
Dosyayı görüntüle @
51398323
...
...
@@ -75,19 +75,6 @@ class Player(models.Model):
return
self
.
name
# To test __search lookup a fulltext index is needed. This
# is only available when using MySQL 5.6, or when using MyISAM
# tables. As 5.6 isn't common yet, lets use MyISAM table for
# testing. The table is manually created by the test method.
# RemovedInDjango20Warning
class
MyISAMArticle
(
models
.
Model
):
headline
=
models
.
CharField
(
max_length
=
100
)
class
Meta
:
db_table
=
'myisam_article'
managed
=
False
class
Product
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
80
)
qty_target
=
models
.
DecimalField
(
max_digits
=
6
,
decimal_places
=
2
)
...
...
tests/lookup/tests.py
Dosyayı görüntüle @
51398323
...
...
@@ -3,16 +3,11 @@ from __future__ import unicode_literals
import
collections
from
datetime
import
datetime
from
operator
import
attrgetter
from
unittest
import
skipUnless
from
django.core.exceptions
import
FieldError
from
django.db
import
connection
from
django.test
import
(
TestCase
,
TransactionTestCase
,
ignore_warnings
,
skipUnlessDBFeature
,
)
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.test
import
TestCase
,
skipUnlessDBFeature
from
.models
import
Article
,
Author
,
Game
,
MyISAMArticle
,
Player
,
Season
,
Tag
from
.models
import
Article
,
Author
,
Game
,
Player
,
Season
,
Tag
class
LookupTests
(
TestCase
):
...
...
@@ -775,26 +770,3 @@ class LookupTests(TestCase):
'<Article: Article 7>'
],
ordered
=
False
)
class
LookupTransactionTests
(
TransactionTestCase
):
available_apps
=
[
'lookup'
]
@ignore_warnings
(
category
=
RemovedInDjango20Warning
)
@skipUnless
(
connection
.
vendor
==
'mysql'
,
'requires MySQL'
)
def
test_mysql_lookup_search
(
self
):
# To use fulltext indexes on MySQL either version 5.6 is needed, or one must use
# MyISAM tables. Neither of these combinations is currently available on CI, so
# lets manually create a MyISAM table for Article model.
with
connection
.
cursor
()
as
cursor
:
cursor
.
execute
(
"CREATE TEMPORARY TABLE myisam_article ("
" id INTEGER PRIMARY KEY AUTO_INCREMENT, "
" headline VARCHAR(100) NOT NULL "
") ENGINE MYISAM"
)
dr
=
MyISAMArticle
.
objects
.
create
(
headline
=
'Django Reinhardt'
)
MyISAMArticle
.
objects
.
create
(
headline
=
'Ringo Star'
)
# NOTE: Needs to be created after the article has been saved.
cursor
.
execute
(
'CREATE FULLTEXT INDEX myisam_article_ft ON myisam_article (headline)'
)
self
.
assertSequenceEqual
(
MyISAMArticle
.
objects
.
filter
(
headline__search
=
'Reinhardt'
),
[
dr
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment