Skip to content

Commit 3696ebd

Browse files
author
Sam Kleinman
committed
minor: note about dropping text indexes
1 parent ac73366 commit 3696ebd

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

source/release-notes/2.4.txt

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Text Indexes
5353
The ``text`` index type is currently an experimental feature.
5454
To use a ``text`` index, you need to enable it at run time or
5555
startup.
56-
56+
5757
Background
5858
``````````
5959

@@ -66,7 +66,7 @@ support boolean text search queries:
6666

6767
- ``text`` indexes are fully consistent and updated in real-time as
6868
applications insert, update, or delete documents from the database.
69-
69+
7070
- The ``text`` index and query system supports language specific
7171
stemming and stop words. Additionally:
7272

@@ -113,11 +113,11 @@ indexes have the following limitations and behaviors:
113113

114114
- A collection may only have a single ``text`` index at a time.
115115

116-
.. warning::
116+
.. warning::
117117

118118
Do **not** enable or use ``text`` indexes on production systems.
119119

120-
.. May be worth including this:
120+
.. May be worth including this:
121121

122122
For production-grade search requirements consider using a
123123
third-party search tool, and the `mongo-connector
@@ -133,9 +133,9 @@ enable the feature before creating or accessing a text index.
133133
To enable text indexes, issue the following command in the
134134
:program:`mongo` shell:
135135

136-
.. warning::
136+
.. warning::
137137

138-
Do **not** enable or use ``text`` indexes on production systems.
138+
Do **not** enable or use ``text`` indexes on production systems.
139139

140140
.. code-block:: javascript
141141

@@ -219,14 +219,14 @@ prefix or suffix of the index. You cannot include :ref:`multi-key
219219
<index-feature-geospatial>` index field.
220220

221221
If you create an ascending or descending index as a prefix of a
222-
``text`` index:
222+
``text`` index:
223223

224224
- MongoDB will only index documents that have the prefix field
225225
(i.e. ``username``) and
226226

227227
- The :dbcommand:`text` query can limit the number of index entries to
228228
review in order to perform the query.
229-
229+
230230
- All :dbcommand:`text` queries using this index must include the
231231
``filter`` option that specifies an equality condition for the prefix
232232
field or fields.
@@ -279,7 +279,7 @@ weights for a ``text`` index with compound fields, as in the following:
279279
about: 5 } } )
280280

281281
This index, named ``TextIndex``, includes a number of fields, with the
282-
following weights:
282+
following weights:
283283

284284
- ``content`` field that has a weight of 10,
285285
- ``users.profiles`` that has a weight of 2,
@@ -292,13 +292,20 @@ will appear in the result set more than all other fields in the index,
292292
and that the ``user.profiles`` and ``comments`` fields will be less
293293
likely to appear in responses than words from other fields.
294294

295+
.. note::
296+
297+
You must drop a ``text`` index using the name specified when you
298+
created the index. Alternatively, if you did not specify a name
299+
when creating the index, you can find the name using
300+
:method:`db.collection.getIndexes()`
301+
295302
Text Queries
296303
^^^^^^^^^^^^
297304

298305
MongoDB 2.3.2 introduces the :dbcommand:`text` command to provide
299306
query support for ``text`` indexes. Unlike normal MongoDB queries,
300307
:dbcommand:`text` returns a document rather than a
301-
cursor.
308+
cursor.
302309

303310
.. dbcommand:: text
304311

@@ -321,7 +328,7 @@ cursor.
321328
A text string that MongoDB stems and uses to query the ``text``
322329
index. In the :program:`mongo` shell, to specify a phrase to
323330
match, you can either:
324-
331+
325332
- enclose the phrase in *escaped* double quotes and use double
326333
quotes to specify the ``search`` string, as in ``"\"coffee
327334
table\""``, or
@@ -336,8 +343,8 @@ cursor.
336343
field. You can use any valid MongoDB query in the filter
337344
document, except if the index includes an ascending or descending
338345
index field as a prefix.
339-
340-
If the index includes an ascending or descending index field as a
346+
347+
If the index includes an ascending or descending index field as a
341348
prefix, the ``filter`` is required and the ``filter`` query must be
342349
an equality match.
343350

@@ -351,22 +358,22 @@ cursor.
351358
Optional. Specify the maximum number of documents to include in
352359
the response. The :dbcommand:`text` sorts the results before
353360
applying the ``limit``.
354-
361+
355362
The default limit is 100.
356363

357364
:param string language:
358-
365+
359366
Optional. Specify the language that determines the tokenization,
360367
stemming, and the stop words for the search. The default language
361368
is ``english``.
362-
369+
363370
:return:
364371

365372
:dbcommand:`text` returns results, in descending order by score,
366373
in the form of a document. Results must fit within the
367374
:limit:`BSON Document Size`. Use the ``limit`` and the
368375
``projection`` parameters to limit the size of the result set.
369-
376+
370377

371378
The implicit connector between the terms of a multi-term search is a
372379
disjunction (``OR``). Search for ``"first second"`` searches
@@ -392,17 +399,17 @@ cursor.
392399

393400
#. Create a ``text`` index on the ``content`` field to enable text
394401
search on the field:
395-
402+
396403
.. code-block:: javascript
397-
404+
398405
db.collection.ensureIndex( { content: "text" } )
399-
406+
400407
#. Search for a single word ``coffee``:
401-
408+
402409
.. code-block:: javascript
403-
410+
404411
db.collection.runCommand( "text", { search: "coffee" } )
405-
412+
406413
This query returns documents that contain the word ``coffee``,
407414
case-insensitive, in the ``content`` field.
408415

@@ -418,9 +425,9 @@ cursor.
418425
#. Search for the exact phrase ``bake coffee cake``:
419426

420427
.. code-block:: javascript
421-
428+
422429
db.collection.runCommand( "text", { search: "\"bake coffee cake\"" } )
423-
430+
424431
This query returns documents that contain the exact phrase
425432
``bake coffee cake``.
426433

@@ -436,12 +443,12 @@ cursor.
436443
either ``bake`` **or** ``coffee``, but **not** ``cake``, all
437444
case-insensitive, in the ``content`` field. Prefixing a word
438445
with a hyphen (``-``) negates a word:
439-
446+
440447
- The negated word filters out documents from the result set,
441-
after selecting documents.
442-
448+
after selecting documents.
449+
443450
- A ``<search string>`` that only contains negative words returns no match.
444-
451+
445452
- A hyphenated word, such as ``case-insensitive``, is not a
446453
negation. The :dbcommand:`text` command treats the hyphen as a
447454
delimiter.
@@ -450,15 +457,15 @@ cursor.
450457
the ``about`` field, but **limit** the results to 2 documents with the
451458
highest score and return only the ``comments`` field in the matching
452459
documents:
453-
460+
454461
.. code-block:: javascript
455-
456-
db.collection.runCommand( "text", {
457-
search: "coffee",
458-
filter: { about: /desserts/ },
459-
limit: 2,
460-
projection: { comments: 1, _id: 0 }
461-
}
462+
463+
db.collection.runCommand( "text", {
464+
search: "coffee",
465+
filter: { about: /desserts/ },
466+
limit: 2,
467+
projection: { comments: 1, _id: 0 }
468+
}
462469
)
463470

464471
- The ``filter`` :ref:`query document <mongodb-query-document>`
@@ -470,7 +477,7 @@ cursor.
470477
exclude (``0``) the ``_id`` field. Within the ``projection``
471478
document, you cannot mix inclusions (i.e. ``<fieldA>: 1``) and
472479
exclusions (i.e. ``<fieldB>: 0``), except for the ``_id`` field.
473-
480+
474481
Additional Authentication Features
475482
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
476483

@@ -561,7 +568,7 @@ current connection with the Kerberos session:
561568

562569
The value of the ``principal`` field *must* be the same principal that
563570
you initialized with ``kinit``. This connection will acquire access in
564-
accordance with all privileges granted to this user for all databases.
571+
accordance with all privileges granted to this user for all databases.
565572

566573
.. see:: :doc:`/security`
567574

0 commit comments

Comments
 (0)