Remove TEXT constant PYTHON-456

The "text search" feature is experimental in
MongoDB 2.4 and the index type may change.
This commit is contained in:
behackett 2013-01-22 17:08:50 -08:00
parent 27f780f5d4
commit 676aef7a7c
4 changed files with 6 additions and 16 deletions

View File

@ -8,7 +8,6 @@
.. autodata:: pymongo.DESCENDING
.. autodata:: pymongo.GEO2D
.. autodata:: pymongo.GEOHAYSTACK
.. autodata:: pymongo.TEXT
.. autoclass:: pymongo.collection.Collection(database, name[, create=False[, **kwargs]]])

View File

@ -40,15 +40,6 @@ GEOHAYSTACK = "geoHaystack"
.. _haystack index: http://docs.mongodb.org/manual/core/geospatial-indexes/#haystack-indexes
"""
TEXT = "text"
"""Index specifier for text search.
.. versionadded:: 2.4.2
.. note:: Text search requires server version **>= 2.3.2**.
"""
OFF = 0
"""No database profiling."""
SLOW_ONLY = 1

View File

@ -69,9 +69,9 @@ def _index_document(index_list):
if not isinstance(key, basestring):
raise TypeError("first item in each key pair must be a string")
if not isinstance(value, (basestring, int)):
raise TypeError("second item in each key pair must be ASCENDING, "
"DESCENDING, GEO2D, GEOHAYSTACK, TEXT, or other "
"valid MongoDB index specifier.")
raise TypeError("second item in each key pair must be 1, -1, "
"'2d', 'geoHaystack', or another valid MongoDB "
"index specifier.")
index[key] = value
return index

View File

@ -33,7 +33,7 @@ from bson.code import Code
from bson.objectid import ObjectId
from bson.py3compat import b
from bson.son import SON
from pymongo import ASCENDING, DESCENDING, GEO2D, GEOHAYSTACK, TEXT
from pymongo import ASCENDING, DESCENDING, GEO2D, GEOHAYSTACK
from pymongo.collection import Collection
from pymongo.son_manipulator import SONManipulator
from pymongo.errors import (ConfigurationError,
@ -387,7 +387,7 @@ class TestCollection(unittest.TestCase):
}, results[0])
def test_index_text(self):
if not version.at_least(self.connection, (2, 3, 2, -1)):
if not version.at_least(self.connection, (2, 3, 2)):
raise SkipTest("Text search requires server >=2.3.2.")
self.connection.admin.command('setParameter', '*',
@ -395,7 +395,7 @@ class TestCollection(unittest.TestCase):
db = self.db
db.test.drop_indexes()
self.assertEqual("t_text", db.test.create_index([("t", TEXT)]))
self.assertEqual("t_text", db.test.create_index([("t", "text")]))
index_info = db.test.index_information()["t_text"]
self.assertTrue("weights" in index_info)
db.test.drop_indexes()