Skip to content

Commit e600fe4

Browse files
kay-kimSam Kleinman
authored andcommitted
reorg text search
1 parent 43f4119 commit e600fe4

15 files changed

+278
-269
lines changed

source/core/indexes.txt

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -838,45 +838,17 @@ to bucket size.
838838

839839
.. versionadded:: 2.4
840840

841-
MongoDB provides ``text`` indexes to support :doc:`text search
842-
</applications/text-search>` on a collection. You can only access the
843-
``text`` index with the :dbcommand:`text` command.
841+
MongoDB provides ``text`` indexes to support the search of string
842+
content in documents of a collection. ``text`` indexes are
843+
case-insensitive and can include any field that contains string data.
844+
``text`` indexes drop language-specific stop words (e.g. in English,
845+
"the," "an," "a," "and," etc.) and uses simple language-specific suffix
846+
stemming. See :ref:`text-search-languages` for the supported languages.
844847

845-
``text`` indexes are case-insensitive and can include any field that
846-
contains string data. ``text`` indexes drop language-specific stop
847-
words (e.g. in English, "the," "an," "a," "and," etc.) and uses simple
848-
language-specific suffix stemming. See :ref:`text-search-languages` for
849-
the supported languages.
848+
You can only access the ``text`` index with the :dbcommand:`text`
849+
command.
850850

851-
``text`` indexes have the following storage requirements and
852-
performance costs:
853-
854-
- ``text`` indexes change the space allocation method for all future
855-
record allocations in a collection to :collflag:`usePowerOf2Sizes`.
856-
857-
- ``text`` indexes can be large. They contain one index entry for each
858-
unique post-stemmed word in each indexed field for each document
859-
inserted.
860-
861-
- Building a ``text`` index is very similar to building a large
862-
multi-key index and will take longer than building a simple ordered
863-
(scalar) index on the same data.
864-
865-
- When building a large ``text`` index on an existing collection,
866-
ensure that you have a sufficiently high limit on open file
867-
descriptors. See the :ref:`recommended settings <oom-killer>`.
868-
869-
- ``text`` indexes will impact insertion throughput because MongoDB
870-
must add an index entry for each unique post-stemmed word in each
871-
indexed field of each new source document.
872-
873-
- Additionally, ``text`` indexes do not store phrases or information
874-
about the proximity of words in the documents. As a result, phrase
875-
queries will run much more effectively when the entire collection
876-
fits in RAM.
877-
878-
See :doc:`/applications/text-search` for more information on the text
879-
search feature.
851+
See :doc:`/core/text-search` for more information.
880852

881853
.. index:: index; limitations
882854
.. _index-limitations:

source/core/text-indexes.txt

Lines changed: 0 additions & 188 deletions
This file was deleted.

source/applications/text-search.txt renamed to source/core/text-search.txt

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,45 @@ The text search process:
2525
By default, :dbcommand:`text` command returns at most the top 100
2626
matching documents as determined by the scores.
2727

28+
.. important::
29+
30+
Before you can create a text index or :ref:`run the text command
31+
<text-search-text-command>`, you need to manually enable the text
32+
search. See :doc:`/tutorial/enable-text-search` for information on
33+
how to enable the text search feature.
34+
35+
.. _text-search-storage-requirements:
36+
37+
Storage Requirements and Performance Costs
38+
------------------------------------------
39+
40+
``text`` indexes have the following storage requirements and
41+
performance costs:
42+
43+
- ``text`` indexes change the space allocation method for all future
44+
record allocations in a collection to :collflag:`usePowerOf2Sizes`.
45+
46+
- ``text`` indexes can be large. They contain one index entry for each
47+
unique post-stemmed word in each indexed field for each document
48+
inserted.
49+
50+
- Building a ``text`` index is very similar to building a large
51+
multi-key index and will take longer than building a simple ordered
52+
(scalar) index on the same data.
53+
54+
- When building a large ``text`` index on an existing collection,
55+
ensure that you have a sufficiently high limit on open file
56+
descriptors. See the :ref:`recommended settings <oom-killer>`.
57+
58+
- ``text`` indexes will impact insertion throughput because MongoDB
59+
must add an index entry for each unique post-stemmed word in each
60+
indexed field of each new source document.
61+
62+
- Additionally, ``text`` indexes do not store phrases or information
63+
about the proximity of words in the documents. As a result, phrase
64+
queries will run much more effectively when the entire collection
65+
fits in RAM.
66+
2867
.. _create-text-index:
2968

3069
Create a ``text`` Index
@@ -38,36 +77,24 @@ the string literal ``text``.
3877

3978
.. important::
4079

41-
- Before you can :ref:`create a text index <create-text-index>` or
42-
:ref:`run the text command <text-search-text-command>`, you need
43-
to manually enable the text search. See
44-
:doc:`/tutorial/enable-text-search` for information on how to
45-
enable the text search feature.
46-
4780
- Text indexes have significant storage requirements and performance
48-
costs. See :ref:`text index feature <index-feature-text>` for more
81+
costs. See :ref:`text-search-storage-requirements` for more
4982
information.
5083

5184
- .. include:: /includes/fact-text-index-limit-one.rst
5285

53-
The following example creates a ``text`` index on the fields
54-
``subject`` and ``content``:
86+
The following tutorials offer additional ``text`` index creation
87+
patterns:
88+
89+
- :doc:`/tutorial/create-text-index-on-multiple-fields`
5590

56-
.. code-block:: javascript
91+
- :doc:`/tutorial/specify-language-for-text-index`
5792

58-
db.collection.ensureIndex(
59-
{
60-
subject: "text",
61-
content: "text"
62-
}
63-
)
93+
- :doc:`/tutorial/avoid-text-index-name-limit`
6494

65-
This ``text`` index catalogs all string data in the ``subject`` field
66-
and the ``content`` field, where the field value is either a string or
67-
an array of string elements.
95+
- :doc:`/tutorial/create-text-index-on-multi-language-collection`
6896

69-
See :doc:`/core/text-indexes` for details on the options available when
70-
creating ``text`` indexes.
97+
- :doc:`/tutorial/control-results-of-text-search`
7198

7299
Additionally, MongoDB permits :ref:`compound indexes
73100
<index-type-compound>` that include ``text`` index fields in
@@ -89,18 +116,6 @@ document field contains the word ``blueberry``, a search on the term
89116
``blue`` will not match the document. However, a search on either
90117
``blueberry`` or ``blueberries`` will match.
91118

92-
By default, the :dbcommand:`text` command returns the top 100 scoring
93-
documents in descending order, but you can specify a ``limit`` option
94-
to change the maximum number to return.
95-
96-
Given a collection with a ``text`` index, use the
97-
:method:`~db.runCommand()` method to execute the
98-
:dbcommand:`text` command, as in:
99-
100-
.. code-block:: javascript
101-
102-
db.collection.runCommand( "text" , { search: <string> } )
103-
104119
For information and examples on various text search patterns, see
105120
:doc:`/tutorial/search-for-text`.
106121

source/includes/fact-text-search-beta.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The :doc:`text search </applications/text-search>` is currently a
1+
The :doc:`text search </core/text-search>` is currently a
22
*beta* feature. As a beta feature:
33

44
- You need to explicitly enable the feature before :ref:`creating a text

source/indexes.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,11 @@ Text Indexing
5858
.. toctree::
5959
:maxdepth: 1
6060

61-
applications/text-search
62-
core/text-indexes
61+
core/text-search
62+
tutorial/create-text-index-on-multiple-fields
63+
tutorial/specify-language-for-text-index
64+
tutorial/avoid-text-index-name-limit
65+
tutorial/create-text-index-on-multi-language-collection
66+
tutorial/control-results-of-text-search
67+
tutorial/limit-number-of-items-scanned-for-text-search
68+
tutorial/return-text-queries-using-only-text-index

0 commit comments

Comments
 (0)