Skip to content

Commit 676aef7

Browse files
committed
Remove TEXT constant PYTHON-456
The "text search" feature is experimental in MongoDB 2.4 and the index type may change.
1 parent 27f780f commit 676aef7

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

doc/api/pymongo/collection.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
.. autodata:: pymongo.DESCENDING
99
.. autodata:: pymongo.GEO2D
1010
.. autodata:: pymongo.GEOHAYSTACK
11-
.. autodata:: pymongo.TEXT
1211

1312
.. autoclass:: pymongo.collection.Collection(database, name[, create=False[, **kwargs]]])
1413

pymongo/__init__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@
4040
.. _haystack index: http://docs.mongodb.org/manual/core/geospatial-indexes/#haystack-indexes
4141
"""
4242

43-
TEXT = "text"
44-
"""Index specifier for text search.
45-
46-
.. versionadded:: 2.4.2
47-
48-
.. note:: Text search requires server version **>= 2.3.2**.
49-
"""
50-
51-
5243
OFF = 0
5344
"""No database profiling."""
5445
SLOW_ONLY = 1

pymongo/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def _index_document(index_list):
6969
if not isinstance(key, basestring):
7070
raise TypeError("first item in each key pair must be a string")
7171
if not isinstance(value, (basestring, int)):
72-
raise TypeError("second item in each key pair must be ASCENDING, "
73-
"DESCENDING, GEO2D, GEOHAYSTACK, TEXT, or other "
74-
"valid MongoDB index specifier.")
72+
raise TypeError("second item in each key pair must be 1, -1, "
73+
"'2d', 'geoHaystack', or another valid MongoDB "
74+
"index specifier.")
7575
index[key] = value
7676
return index
7777

test/test_collection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from bson.objectid import ObjectId
3434
from bson.py3compat import b
3535
from bson.son import SON
36-
from pymongo import ASCENDING, DESCENDING, GEO2D, GEOHAYSTACK, TEXT
36+
from pymongo import ASCENDING, DESCENDING, GEO2D, GEOHAYSTACK
3737
from pymongo.collection import Collection
3838
from pymongo.son_manipulator import SONManipulator
3939
from pymongo.errors import (ConfigurationError,
@@ -387,15 +387,15 @@ def test_index_haystack(self):
387387
}, results[0])
388388

389389
def test_index_text(self):
390-
if not version.at_least(self.connection, (2, 3, 2, -1)):
390+
if not version.at_least(self.connection, (2, 3, 2)):
391391
raise SkipTest("Text search requires server >=2.3.2.")
392392

393393
self.connection.admin.command('setParameter', '*',
394394
textSearchEnabled=True)
395395

396396
db = self.db
397397
db.test.drop_indexes()
398-
self.assertEqual("t_text", db.test.create_index([("t", TEXT)]))
398+
self.assertEqual("t_text", db.test.create_index([("t", "text")]))
399399
index_info = db.test.index_information()["t_text"]
400400
self.assertTrue("weights" in index_info)
401401
db.test.drop_indexes()

0 commit comments

Comments
 (0)